1. /*
  2. * Copyright (c) 2004 World Wide Web Consortium,
  3. *
  4. * (Massachusetts Institute of Technology, European Research Consortium for
  5. * Informatics and Mathematics, Keio University). All Rights Reserved. This
  6. * work is distributed under the W3C(r) Software License [1] in the hope that
  7. * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
  8. * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. *
  10. * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
  11. */
  12. package org.w3c.dom.ls;
  13. /**
  14. * This interface represents an output destination for data.
  15. * <p> This interface allows an application to encapsulate information about
  16. * an output destination in a single object, which may include a URI, a byte
  17. * stream (possibly with a specified encoding), a base URI, and/or a
  18. * character stream.
  19. * <p> The exact definitions of a byte stream and a character stream are
  20. * binding dependent.
  21. * <p> The application is expected to provide objects that implement this
  22. * interface whenever such objects are needed. The application can either
  23. * provide its own objects that implement this interface, or it can use the
  24. * generic factory method <code>DOMImplementationLS.createLSOutput()</code>
  25. * to create objects that implement this interface.
  26. * <p> The <code>LSSerializer</code> will use the <code>LSOutput</code> object
  27. * to determine where to serialize the output to. The
  28. * <code>LSSerializer</code> will look at the different outputs specified in
  29. * the <code>LSOutput</code> in the following order to know which one to
  30. * output to, the first one that is not null and not an empty string will be
  31. * used:
  32. * <ol>
  33. * <li> <code>LSOutput.characterStream</code>
  34. * </li>
  35. * <li>
  36. * <code>LSOutput.byteStream</code>
  37. * </li>
  38. * <li> <code>LSOutput.systemId</code>
  39. * </li>
  40. * </ol>
  41. * <p> <code>LSOutput</code> objects belong to the application. The DOM
  42. * implementation will never modify them (though it may make copies and
  43. * modify the copies, if necessary).
  44. * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407'>Document Object Model (DOM) Level 3 Load
  45. and Save Specification</a>.
  46. */
  47. public interface LSOutput {
  48. /**
  49. * An attribute of a language and binding dependent type that represents
  50. * a writable stream to which 16-bit units can be output.
  51. */
  52. public java.io.Writer getCharacterStream();
  53. /**
  54. * An attribute of a language and binding dependent type that represents
  55. * a writable stream to which 16-bit units can be output.
  56. */
  57. public void setCharacterStream(java.io.Writer characterStream);
  58. /**
  59. * An attribute of a language and binding dependent type that represents
  60. * a writable stream of bytes.
  61. */
  62. public java.io.OutputStream getByteStream();
  63. /**
  64. * An attribute of a language and binding dependent type that represents
  65. * a writable stream of bytes.
  66. */
  67. public void setByteStream(java.io.OutputStream byteStream);
  68. /**
  69. * The system identifier, a URI reference [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>], for this
  70. * output destination.
  71. * <br> If the system ID is a relative URI reference (see section 5 in [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>]), the
  72. * behavior is implementation dependent.
  73. */
  74. public String getSystemId();
  75. /**
  76. * The system identifier, a URI reference [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>], for this
  77. * output destination.
  78. * <br> If the system ID is a relative URI reference (see section 5 in [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>]), the
  79. * behavior is implementation dependent.
  80. */
  81. public void setSystemId(String systemId);
  82. /**
  83. * The character encoding to use for the output. The encoding must be a
  84. * string acceptable for an XML encoding declaration ([<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>] section
  85. * 4.3.3 "Character Encoding in Entities"), it is recommended that
  86. * character encodings registered (as charsets) with the Internet
  87. * Assigned Numbers Authority [<a href='ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets'>IANA-CHARSETS</a>]
  88. * should be referred to using their registered names.
  89. */
  90. public String getEncoding();
  91. /**
  92. * The character encoding to use for the output. The encoding must be a
  93. * string acceptable for an XML encoding declaration ([<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>] section
  94. * 4.3.3 "Character Encoding in Entities"), it is recommended that
  95. * character encodings registered (as charsets) with the Internet
  96. * Assigned Numbers Authority [<a href='ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets'>IANA-CHARSETS</a>]
  97. * should be referred to using their registered names.
  98. */
  99. public void setEncoding(String encoding);
  100. }