示例#1
0
 /*
  * Constructs a new InputStreamReader on the InputStream {@code in} and
  * CharsetDecoder {@code dec}.
  *
  * @param in
  *            the source InputStream from which to read characters.
  * @param dec
  *            the CharsetDecoder used by the character conversion.
  */
 public InputStreamReader(InputStream inJ, java.nio.charset.CharsetDecoder dec) : base(inJ)
 {
     dec.averageCharsPerByte();
     this.inJ = inJ;
     decoder  = dec;
     bytes.limit(0);
 }
示例#2
0
 /*
  * Constructs a new InputStreamReader on the InputStream {@code in} and
  * Charset {@code charset}.
  *
  * @param in
  *            the source InputStream from which to read characters.
  * @param charset
  *            the Charset that defines the character converter
  */
 public InputStreamReader(InputStream inJ, java.nio.charset.Charset charset) : base(inJ)
 {
     this.inJ = inJ;
     decoder  = charset.newDecoder().onMalformedInput(
         java.nio.charset.CodingErrorAction.REPLACE).onUnmappableCharacter(
         java.nio.charset.CodingErrorAction.REPLACE);
     bytes.limit(0);
 }
示例#3
0
        /**
         * Closes this reader. This implementation closes the source InputStream and
         * releases all local storage.
         *
         * @throws IOException
         *             if an error occurs attempting to close this reader.
         */

        public override void close() // throws IOException {
        {
            lock (this.lockJ) {
                decoder = null;
                if (inJ != null)
                {
                    inJ.close();
                    inJ = null;
                }
            }
        }
示例#4
0
 /**
  * Constructs a new {@code InputStreamReader} on the {@link InputStream}
  * {@code in}. This constructor sets the character converter to the encoding
  * specified in the "file.encoding" property and falls back to ISO 8859_1
  * (ISO-Latin-1) if the property doesn't exist.
  *
  * @param in
  *            the input stream from which to read characters.
  */
 public InputStreamReader(InputStream inJ)
     : base(inJ)
 {
     this.inJ = inJ;
     /*String encoding = AccessController
             .doPrivileged(new PriviAction<String>(
                     "file.encoding", "ISO8859_1")); //$NON-NLS-1$//$NON-NLS-2$*/
     String encoding = java.lang.SystemJ.getProperty("file.encoding", "ISO8859_1");
     decoder = java.nio.charset.Charset.forName(encoding).newDecoder().onMalformedInput(
             java.nio.charset.CodingErrorAction.REPLACE).onUnmappableCharacter(
             java.nio.charset.CodingErrorAction.REPLACE);
     bytes.limit(0);
 }
示例#5
0
        /*
         * Constructs a new {@code InputStreamReader} on the {@link InputStream}
         * {@code in}. This constructor sets the character converter to the encoding
         * specified in the "file.encoding" property and falls back to ISO 8859_1
         * (ISO-Latin-1) if the property doesn't exist.
         *
         * @param in
         *            the input stream from which to read characters.
         */
        public InputStreamReader(InputStream inJ) : base(inJ)
        {
            this.inJ = inJ;

            /*String encoding = AccessController
             *      .doPrivileged(new PriviAction<String>(
             *              "file.encoding", "ISO8859_1")); //$NON-NLS-1$//$NON-NLS-2$*/
            String encoding = java.lang.SystemJ.getProperty("file.encoding", "ISO8859_1");

            decoder = java.nio.charset.Charset.forName(encoding).newDecoder().onMalformedInput(
                java.nio.charset.CodingErrorAction.REPLACE).onUnmappableCharacter(
                java.nio.charset.CodingErrorAction.REPLACE);
            bytes.limit(0);
        }
示例#6
0
 /**
  * Constructs a new InputStreamReader on the InputStream {@code in}. The
  * character converter that is used to decode bytes into characters is
  * identified by name by {@code enc}. If the encoding cannot be found, an
  * UnsupportedEncodingException error is thrown.
  *
  * @param in
  *            the InputStream from which to read characters.
  * @param enc
  *            identifies the character converter to use.
  * @throws NullPointerException
  *             if {@code enc} is {@code null}.
  * @throws UnsupportedEncodingException
  *             if the encoding specified by {@code enc} cannot be found.
  */
 public InputStreamReader(InputStream inJ, String enc) : base(inJ)
 {
     //throws UnsupportedEncodingException {
     if (enc == null)
     {
         throw new java.lang.NullPointerException();
     }
     this.inJ = inJ;
     try {
         decoder = java.nio.charset.Charset.forName(enc).newDecoder().onMalformedInput(
             java.nio.charset.CodingErrorAction.REPLACE).onUnmappableCharacter(
             java.nio.charset.CodingErrorAction.REPLACE);
     } catch (java.lang.IllegalArgumentException e) {
         throw (UnsupportedEncodingException)
               new UnsupportedEncodingException(enc).initCause(e);
     }
     bytes.limit(0);
 }
示例#7
0
 /**
  * Constructs a new InputStreamReader on the InputStream {@code in}. The
  * character converter that is used to decode bytes into characters is
  * identified by name by {@code enc}. If the encoding cannot be found, an
  * UnsupportedEncodingException error is thrown.
  *
  * @param in
  *            the InputStream from which to read characters.
  * @param enc
  *            identifies the character converter to use.
  * @throws NullPointerException
  *             if {@code enc} is {@code null}.
  * @throws UnsupportedEncodingException
  *             if the encoding specified by {@code enc} cannot be found.
  */
 public InputStreamReader(InputStream inJ, String enc)
     : base(inJ)
 {
     //throws UnsupportedEncodingException {
     if (enc == null) {
         throw new java.lang.NullPointerException();
     }
     this.inJ = inJ;
     try {
         decoder = java.nio.charset.Charset.forName(enc).newDecoder().onMalformedInput(
                 java.nio.charset.CodingErrorAction.REPLACE).onUnmappableCharacter(
                 java.nio.charset.CodingErrorAction.REPLACE);
     } catch (java.lang.IllegalArgumentException e) {
         throw (UnsupportedEncodingException)
                 new UnsupportedEncodingException(enc).initCause(e);
     }
     bytes.limit(0);
 }
示例#8
0
 /**
  * Closes this reader. This implementation closes the source InputStream and
  * releases all local storage.
  *
  * @throws IOException
  *             if an error occurs attempting to close this reader.
  */
 public override void close()
 {
     // throws IOException {
     lock (this.lockJ) {
         decoder = null;
         if (inJ != null) {
             inJ.close();
             inJ = null;
         }
     }
 }
示例#9
0
 /**
  * Constructs a new InputStreamReader on the InputStream {@code in} and
  * Charset {@code charset}.
  *
  * @param in
  *            the source InputStream from which to read characters.
  * @param charset
  *            the Charset that defines the character converter
  */
 public InputStreamReader(InputStream inJ, java.nio.charset.Charset charset)
     : base(inJ)
 {
     this.inJ = inJ;
     decoder = charset.newDecoder().onMalformedInput(
             java.nio.charset.CodingErrorAction.REPLACE).onUnmappableCharacter(
             java.nio.charset.CodingErrorAction.REPLACE);
     bytes.limit(0);
 }
示例#10
0
 /**
  * Constructs a new InputStreamReader on the InputStream {@code in} and
  * CharsetDecoder {@code dec}.
  *
  * @param in
  *            the source InputStream from which to read characters.
  * @param dec
  *            the CharsetDecoder used by the character conversion.
  */
 public InputStreamReader(InputStream inJ, java.nio.charset.CharsetDecoder dec)
     : base(inJ)
 {
     dec.averageCharsPerByte();
     this.inJ = inJ;
     decoder = dec;
     bytes.limit(0);
 }