001    /*
002     * Copyright (c) 2004 World Wide Web Consortium,
003     *
004     * (Massachusetts Institute of Technology, European Research Consortium for
005     * Informatics and Mathematics, Keio University). All Rights Reserved. This
006     * work is distributed under the W3C(r) Software License [1] in the hope that
007     * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
008     * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
009     *
010     * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
011     */
012    
013    package org.w3c.dom.ls;
014    
015    /**
016     *  This interface represents an output destination for data. 
017     * <p> This interface allows an application to encapsulate information about 
018     * an output destination in a single object, which may include a URI, a byte 
019     * stream (possibly with a specified encoding), a base URI, and/or a 
020     * character stream. 
021     * <p> The exact definitions of a byte stream and a character stream are 
022     * binding dependent. 
023     * <p> The application is expected to provide objects that implement this 
024     * interface whenever such objects are needed. The application can either 
025     * provide its own objects that implement this interface, or it can use the 
026     * generic factory method <code>DOMImplementationLS.createLSOutput()</code> 
027     * to create objects that implement this interface. 
028     * <p> The <code>LSSerializer</code> will use the <code>LSOutput</code> object 
029     * to determine where to serialize the output to. The 
030     * <code>LSSerializer</code> will look at the different outputs specified in 
031     * the <code>LSOutput</code> in the following order to know which one to 
032     * output to, the first one that is not null and not an empty string will be 
033     * used: 
034     * <ol>
035     * <li> <code>LSOutput.characterStream</code> 
036     * </li>
037     * <li> 
038     * <code>LSOutput.byteStream</code> 
039     * </li>
040     * <li> <code>LSOutput.systemId</code> 
041     * </li>
042     * </ol> 
043     * <p> <code>LSOutput</code> objects belong to the application. The DOM 
044     * implementation will never modify them (though it may make copies and 
045     * modify the copies, if necessary). 
046     * <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
047    and Save Specification</a>.
048     */
049    public interface LSOutput {
050        /**
051         *  An attribute of a language and binding dependent type that represents 
052         * a writable stream to which 16-bit units can be output. 
053         */
054        public java.io.Writer getCharacterStream();
055        /**
056         *  An attribute of a language and binding dependent type that represents 
057         * a writable stream to which 16-bit units can be output. 
058         */
059        public void setCharacterStream(java.io.Writer characterStream);
060    
061        /**
062         *  An attribute of a language and binding dependent type that represents 
063         * a writable stream of bytes. 
064         */
065        public java.io.OutputStream getByteStream();
066        /**
067         *  An attribute of a language and binding dependent type that represents 
068         * a writable stream of bytes. 
069         */
070        public void setByteStream(java.io.OutputStream byteStream);
071    
072        /**
073         *  The system identifier, a URI reference [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>], for this 
074         * output destination. 
075         * <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 
076         * behavior is implementation dependent. 
077         */
078        public String getSystemId();
079        /**
080         *  The system identifier, a URI reference [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>], for this 
081         * output destination. 
082         * <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 
083         * behavior is implementation dependent. 
084         */
085        public void setSystemId(String systemId);
086    
087        /**
088         *  The character encoding to use for the output. The encoding must be a 
089         * string acceptable for an XML encoding declaration ([<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>] section 
090         * 4.3.3 "Character Encoding in Entities"), it is recommended that 
091         * character encodings registered (as charsets) with the Internet 
092         * Assigned Numbers Authority [<a href='ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets'>IANA-CHARSETS</a>]
093         *  should be referred to using their registered names. 
094         */
095        public String getEncoding();
096        /**
097         *  The character encoding to use for the output. The encoding must be a 
098         * string acceptable for an XML encoding declaration ([<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>] section 
099         * 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    }