Class SingleByteReceiver

  • Direct Known Subclasses:
    BOMEncodingDetector

    public abstract class SingleByteReceiver
    extends ByteReceiver
    This class represents a receiver for a series of single bytes.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected byte[] byteBuffer  
    • Constructor Summary

      Constructors 
      Constructor Description
      SingleByteReceiver​(int chunkSize)
      Constructor
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract boolean dealWithByte​(byte b)
      Receive a byte.
      boolean dealWithBytes​(java.io.InputStream inputStream)
      Read a byte stream and process bytes.
      protected boolean dealWithRemainder​(byte[] buffer, int offset, int len, java.io.InputStream inputStream)
      Deal with the remainder of the input.
      • Methods inherited from class java.lang.Object

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

      • byteBuffer

        protected final byte[] byteBuffer
    • Constructor Detail

      • SingleByteReceiver

        public SingleByteReceiver​(int chunkSize)
        Constructor
    • Method Detail

      • dealWithBytes

        public final boolean dealWithBytes​(java.io.InputStream inputStream)
                                    throws java.io.IOException,
                                           ManifoldCFException
        Read a byte stream and process bytes.
        Specified by:
        dealWithBytes in class ByteReceiver
        Returns:
        true if abort signalled, false if end of stream reached.
        Throws:
        java.io.IOException
        ManifoldCFException
      • dealWithByte

        public abstract boolean dealWithByte​(byte b)
                                      throws java.io.IOException,
                                             ManifoldCFException
        Receive a byte.
        Returns:
        true to stop further processing.
        Throws:
        java.io.IOException
        ManifoldCFException
      • dealWithRemainder

        protected boolean dealWithRemainder​(byte[] buffer,
                                            int offset,
                                            int len,
                                            java.io.InputStream inputStream)
                                     throws java.io.IOException,
                                            ManifoldCFException
        Deal with the remainder of the input. This is called only when dealWithByte() returns true.
        Parameters:
        buffer - is the buffer of characters that should come first.
        offset - is the offset within the buffer of the first character.
        len - is the number of characters in the buffer.
        inputStream - is the stream that should come after the characters in the buffer.
        Returns:
        true to abort, false if the end of the stream has been reached.
        Throws:
        java.io.IOException
        ManifoldCFException