Class UnicodeDetectingInputStream

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

    class UnicodeDetectingInputStream
    extends java.io.FilterInputStream
    A filter stream that detects the unicode encoding for the original stream
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static byte BB  
      private static byte BF  
      private byte[] buf  
      private int bufLen  
      private java.nio.charset.Charset charset  
      private int curIndex  
      private static byte EF  
      private static byte FE  
      private static byte FF  
      private static byte NUL  
      private static java.nio.charset.Charset UTF_16BE  
      private static java.nio.charset.Charset UTF_16LE  
      private static java.nio.charset.Charset UTF_32BE  
      private static java.nio.charset.Charset UTF_32LE  
      private static java.nio.charset.Charset UTF_8  
      • Fields inherited from class java.io.FilterInputStream

        in
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.nio.charset.Charset detectEncoding()  
      private void fillBuf()  
      (package private) java.nio.charset.Charset getCharset()  
      int read()  
      int read​(byte[] b, int off, int len)  
      • Methods inherited from class java.io.FilterInputStream

        available, close, mark, markSupported, read, reset, skip
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • UTF_8

        private static final java.nio.charset.Charset UTF_8
      • UTF_16BE

        private static final java.nio.charset.Charset UTF_16BE
      • UTF_16LE

        private static final java.nio.charset.Charset UTF_16LE
      • UTF_32LE

        private static final java.nio.charset.Charset UTF_32LE
      • UTF_32BE

        private static final java.nio.charset.Charset UTF_32BE
      • buf

        private final byte[] buf
      • bufLen

        private int bufLen
      • curIndex

        private int curIndex
      • charset

        private final java.nio.charset.Charset charset
    • Constructor Detail

      • UnicodeDetectingInputStream

        UnicodeDetectingInputStream​(java.io.InputStream is)
    • Method Detail

      • getCharset

        java.nio.charset.Charset getCharset()
      • fillBuf

        private void fillBuf()
      • detectEncoding

        private java.nio.charset.Charset detectEncoding()
      • read

        public int read()
                 throws java.io.IOException
        Overrides:
        read in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.FilterInputStream
        Throws:
        java.io.IOException