Class RpcUnicodeInputStream

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

    public class RpcUnicodeInputStream
    extends java.io.InputStream
    InputStream wrapper that detects and skips the Unicode BOM (Byte Order Mark) in Unicode encoded text files.
     EF BB BF    = UTF-8 BOM
     FF FE       = UTF-16, little-endian BOM
     FE FF       = UTF-16, big-endian BOM
     FF FE 00 00 = UTF-32, little-endian BOM
     00 00 FE FF = UTF-32, big-endian BOM
     
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  RpcUnicodeInputStream.BOM
      Types of Unicode BOMs.
    • Constructor Summary

      Constructors 
      Constructor Description
      RpcUnicodeInputStream​(java.io.InputStream inputStream)
      Constructs a new RpcUnicodeInputStream that wraps the InputStream.
    • Constructor Detail

      • RpcUnicodeInputStream

        public RpcUnicodeInputStream​(java.io.InputStream inputStream)
                              throws java.lang.NullPointerException,
                                     java.io.IOException
        Constructs a new RpcUnicodeInputStream that wraps the InputStream.
        Parameters:
        inputStream - inputStream
        Throws:
        java.lang.NullPointerException - on error
        java.io.IOException - on error
    • Method Detail

      • skipBOM

        public final RpcUnicodeInputStream skipBOM()
                                            throws java.io.IOException
        Skips the BOM found in the InputStream.
        Returns:
        this
        Throws:
        java.io.IOException - on error
      • read

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

        public int read​(byte[] b)
                 throws java.io.IOException,
                        java.lang.NullPointerException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
        java.lang.NullPointerException
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException,
                        java.lang.NullPointerException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
        java.lang.NullPointerException
      • skip

        public long skip​(long n)
                  throws java.io.IOException
        Overrides:
        skip in class java.io.InputStream
        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
      • mark

        public void mark​(int readlimit)
        Overrides:
        mark in class java.io.InputStream
      • reset

        public void reset()
                   throws java.io.IOException
        Overrides:
        reset in class java.io.InputStream
        Throws:
        java.io.IOException
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.InputStream