Class BOMInputStream

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

    class BOMInputStream
    extends java.io.FilterInputStream
    Stripped down version of Commons IO 2.0's BOMInputStream.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int[][] BOMS  
      private int fbIndex  
      private int fbLength  
      private int[] firstBytes  
      private boolean markedAtStart  
      private int markFbIndex  
      • Fields inherited from class java.io.FilterInputStream

        in
    • Constructor Summary

      Constructors 
      Constructor Description
      BOMInputStream​(java.io.InputStream s)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private boolean find()  
      private void getBOM()  
      void mark​(int readlimit)  
      private boolean matches​(int[] bom)  
      int read()  
      int read​(byte[] buf)  
      int read​(byte[] buf, int off, int len)  
      private int readFirstBytes()  
      void reset()  
      long skip​(long n)  
      • Methods inherited from class java.io.FilterInputStream

        available, close, markSupported
      • Methods inherited from class java.io.InputStream

        nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
      • Methods inherited from class java.lang.Object

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

      • firstBytes

        private int[] firstBytes
      • fbLength

        private int fbLength
      • fbIndex

        private int fbIndex
      • markFbIndex

        private int markFbIndex
      • markedAtStart

        private boolean markedAtStart
      • BOMS

        private static final int[][] BOMS
    • Constructor Detail

      • BOMInputStream

        BOMInputStream​(java.io.InputStream s)
    • Method Detail

      • read

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

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

        public int read​(byte[] buf)
                 throws java.io.IOException
        Overrides:
        read in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • readFirstBytes

        private int readFirstBytes()
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • getBOM

        private void getBOM()
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • mark

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

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

        public long skip​(long n)
                  throws java.io.IOException
        Overrides:
        skip in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • find

        private boolean find()
      • matches

        private boolean matches​(int[] bom)