Class ByteArrayStopEncoding.ByteArrayStopCodec

    • Constructor Detail

      • ByteArrayStopCodec

        public ByteArrayStopCodec​(byte stopByte,
                                  InputStream inputStream,
                                  OutputStream outputStream)
    • Method Detail

      • read

        public byte[] read​(BitInputStream bitInputStream)
                    throws IOException
        Description copied from interface: BitCodec
        Read a single object from the bit stream.
        Specified by:
        read in interface BitCodec<byte[]>
        Specified by:
        read in class AbstractBitCodec<byte[]>
        Parameters:
        bitInputStream - the bit input stream to rad from
        Returns:
        an object from the stream
        Throws:
        IOException - as per java IO contract
      • read

        public byte[] read​(BitInputStream bitInputStream,
                           int length)
                    throws IOException
        Description copied from interface: BitCodec
        Read a array of specified length from the bit stream.
        Specified by:
        read in interface BitCodec<byte[]>
        Specified by:
        read in class AbstractBitCodec<byte[]>
        Parameters:
        bitInputStream - the bit input stream to rad from param valueLen the number of elements to read
        Returns:
        an object from the stream
        Throws:
        IOException - as per java IO contract
      • write

        public long write​(BitOutputStream bitOutputStream,
                          byte[] object)
                   throws IOException
        Description copied from interface: BitCodec
        Write an object into the bit stream
        Specified by:
        write in interface BitCodec<byte[]>
        Specified by:
        write in class AbstractBitCodec<byte[]>
        Parameters:
        bitOutputStream - the output bit stream to write to
        object - the object to write
        Returns:
        the number of bits written out
        Throws:
        IOException - as per java IO contract
      • numberOfBits

        public long numberOfBits​(byte[] object)
        Description copied from interface: BitCodec
        Calculate the number of bits that the object would take in bit serialized form.
        Specified by:
        numberOfBits in interface BitCodec<byte[]>
        Specified by:
        numberOfBits in class AbstractBitCodec<byte[]>
        Parameters:
        object - an object
        Returns:
        the number of bits