Source for org.w3c.dom.ls.LSOutput

   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: 
  13: package org.w3c.dom.ls;
  14: 
  15: /**
  16:  *  This interface represents an output destination for data. 
  17:  * <p> This interface allows an application to encapsulate information about 
  18:  * an output destination in a single object, which may include a URI, a byte 
  19:  * stream (possibly with a specified encoding), a base URI, and/or a 
  20:  * character stream. 
  21:  * <p> The exact definitions of a byte stream and a character stream are 
  22:  * binding dependent. 
  23:  * <p> The application is expected to provide objects that implement this 
  24:  * interface whenever such objects are needed. The application can either 
  25:  * provide its own objects that implement this interface, or it can use the 
  26:  * generic factory method <code>DOMImplementationLS.createLSOutput()</code> 
  27:  * to create objects that implement this interface. 
  28:  * <p> The <code>LSSerializer</code> will use the <code>LSOutput</code> object 
  29:  * to determine where to serialize the output to. The 
  30:  * <code>LSSerializer</code> will look at the different outputs specified in 
  31:  * the <code>LSOutput</code> in the following order to know which one to 
  32:  * output to, the first one that is not null and not an empty string will be 
  33:  * used: 
  34:  * <ol>
  35:  * <li> <code>LSOutput.characterStream</code> 
  36:  * </li>
  37:  * <li> 
  38:  * <code>LSOutput.byteStream</code> 
  39:  * </li>
  40:  * <li> <code>LSOutput.systemId</code> 
  41:  * </li>
  42:  * </ol> 
  43:  * <p> <code>LSOutput</code> objects belong to the application. The DOM 
  44:  * implementation will never modify them (though it may make copies and 
  45:  * modify the copies, if necessary). 
  46:  * <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
  47: and Save Specification</a>.
  48:  */
  49: public interface LSOutput {
  50:     /**
  51:      *  An attribute of a language and binding dependent type that represents 
  52:      * a writable stream to which 16-bit units can be output. 
  53:      */
  54:     public java.io.Writer getCharacterStream();
  55:     /**
  56:      *  An attribute of a language and binding dependent type that represents 
  57:      * a writable stream to which 16-bit units can be output. 
  58:      */
  59:     public void setCharacterStream(java.io.Writer characterStream);
  60: 
  61:     /**
  62:      *  An attribute of a language and binding dependent type that represents 
  63:      * a writable stream of bytes. 
  64:      */
  65:     public java.io.OutputStream getByteStream();
  66:     /**
  67:      *  An attribute of a language and binding dependent type that represents 
  68:      * a writable stream of bytes. 
  69:      */
  70:     public void setByteStream(java.io.OutputStream byteStream);
  71: 
  72:     /**
  73:      *  The system identifier, a URI reference [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>], for this 
  74:      * output destination. 
  75:      * <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 
  76:      * behavior is implementation dependent. 
  77:      */
  78:     public String getSystemId();
  79:     /**
  80:      *  The system identifier, a URI reference [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>], for this 
  81:      * output destination. 
  82:      * <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 
  83:      * behavior is implementation dependent. 
  84:      */
  85:     public void setSystemId(String systemId);
  86: 
  87:     /**
  88:      *  The character encoding to use for the output. The encoding must be a 
  89:      * string acceptable for an XML encoding declaration ([<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>] section 
  90:      * 4.3.3 "Character Encoding in Entities"), it is recommended that 
  91:      * character encodings registered (as charsets) with the Internet 
  92:      * Assigned Numbers Authority [<a href='ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets'>IANA-CHARSETS</a>]
  93:      *  should be referred to using their registered names. 
  94:      */
  95:     public String getEncoding();
  96:     /**
  97:      *  The character encoding to use for the output. The encoding must be a 
  98:      * string acceptable for an XML encoding declaration ([<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>] section 
  99:      * 4.3.3 "Character Encoding in Entities"), it is recommended that 
 100:      * character encodings registered (as charsets) with the Internet 
 101:      * Assigned Numbers Authority [<a href='ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets'>IANA-CHARSETS</a>]
 102:      *  should be referred to using their registered names. 
 103:      */
 104:     public void setEncoding(String encoding);
 105: 
 106: }