Class RecordInputStream

  • All Implemented Interfaces:
    LittleEndianInput

    public final class RecordInputStream
    extends Object
    implements LittleEndianInput
    Title: Record Input Stream Description: Wraps a stream and provides helper methods for the construction of records.
    • Field Detail

      • MAX_RECORD_DATA_SIZE

        public static final short MAX_RECORD_DATA_SIZE
        Maximum size of a single record (minus the 4 byte header) without a continue
        See Also:
        Constant Field Values
    • Method Detail

      • read

        public int read​(byte[] b,
                        int off,
                        int len)
      • getSid

        public short getSid()
      • readPlain

        public void readPlain​(byte[] buf,
                              int off,
                              int len)
        Description copied from interface: LittleEndianInput
        Usually acts the same as LittleEndianInput.readFully(byte[], int, int), but for an encrypted stream the raw (unencrypted) data is filled
        Specified by:
        readPlain in interface LittleEndianInput
        Parameters:
        buf - the byte array to receive the bytes
        off - the start offset into the byte array
        len - the amount of bytes to fill
      • readString

        public String readString()
      • readUnicodeLEString

        public String readUnicodeLEString​(int requestedLength)
        given a byte array of 16-bit unicode characters, compress to 8-bit and return a string { 0x16, 0x00 } -0x16
        Parameters:
        requestedLength - the length of the final string
        Returns:
        the converted string
        Throws:
        IllegalArgumentException - if len is too large (i.e., there is not enough data in string to create a String of that length)
      • readCompressedUnicode

        public String readCompressedUnicode​(int requestedLength)
      • readRemainder

        public byte[] readRemainder()
        Returns the remaining bytes for the current record.
        Returns:
        The remaining bytes of the current record.
      • readAllContinuedRemainder

        @Deprecated
        public byte[] readAllContinuedRemainder()
        Deprecated.
        POI 2.0 Best to write an input stream that wraps this one where there is special sub record that may overlap continue records.
        Reads all byte data for the current record, including any that overlaps into any following continue records.
        Returns:
        all byte data for the current record
      • remaining

        public int remaining()
        The remaining number of bytes in the current record.
        Returns:
        The number of bytes remaining in the current record
      • getNextSid

        public int getNextSid()
        Returns:
        sid of next record. Can be called after hasNextRecord()
      • mark

        @Internal
        public void mark​(int readlimit)
        Mark the stream position - experimental function
        Parameters:
        readlimit - the read ahead limit
        See Also:
        InputStream.mark(int)
      • reset

        @Internal
        public void reset()
                   throws IOException
        Resets the stream position to the previously marked position. Experimental function - this only works, when nextRecord() wasn't called in the meantime.
        Throws:
        IOException - if marking is not supported
        See Also:
        InputStream.reset()
      • isEncrypted

        @Internal
        public boolean isEncrypted()