Class ReEncodedInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class ReEncodedInputStream
    extends java.io.InputStream
    ReEncodedInputStream passes stream from Reader, which is stream of decoded style, to user of this subclass of InputStream, which is stream of encoded style. The encoding of stream passed to user is limited to UTF8. This class will be used to pass stream, which is served as a Reader, as a InputStream of a arbitrary encoding.
    • Field Detail

      • reader_

        private java.io.Reader reader_
      • decodedBuffer_

        private char[] decodedBuffer_
      • encodedStreamWriter_

        private java.io.OutputStreamWriter encodedStreamWriter_
      • encodedInputStream_

        private java.io.ByteArrayInputStream encodedInputStream_
    • Constructor Detail

      • ReEncodedInputStream

        public ReEncodedInputStream​(java.io.Reader reader)
                             throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • reEncode

        private java.io.ByteArrayInputStream reEncode​(java.io.Reader reader)
                                               throws java.io.IOException
        Throws:
        java.io.IOException
      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.InputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • finalize

        protected void finalize()
                         throws java.io.IOException
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.io.IOException