public final class RecordInputStream extends Object implements LittleEndianInput
Description: Wraps a stream and provides helper methods for the construction of records.
Modifier and Type | Class and Description |
---|---|
static class |
RecordInputStream.LeftoverDataException
For use in
BiffViewer which may construct Record s that don't completely
read all available data. |
Modifier and Type | Field and Description |
---|---|
static short |
MAX_RECORD_DATA_SIZE
Maximum size of a single record (minus the 4 byte header) without a continue
|
Constructor and Description |
---|
RecordInputStream(InputStream in) |
RecordInputStream(InputStream in,
Biff8EncryptionKey key,
int initialOffset) |
Modifier and Type | Method and Description |
---|---|
int |
available() |
int |
getNextSid() |
short |
getSid() |
boolean |
hasNextRecord()
Note - this method is expected to be called only when completed reading the current BIFF
record.
|
void |
nextRecord()
Moves to the next record in the stream.
|
int |
read(byte[] b,
int off,
int len) |
byte[] |
readAllContinuedRemainder()
Deprecated.
Best to write a input stream that wraps this one where there is
special sub record that may overlap continue records.
|
byte |
readByte()
Reads an 8 bit, signed value
|
String |
readCompressedUnicode(int requestedLength) |
double |
readDouble() |
void |
readFully(byte[] buf) |
void |
readFully(byte[] buf,
int off,
int len) |
int |
readInt()
Reads a 32 bit, signed value
|
long |
readLong()
Reads a 64 bit, signed value
|
byte[] |
readRemainder()
Returns the remaining bytes for the current record.
|
short |
readShort()
Reads a 16 bit, signed value
|
String |
readString() |
int |
readUByte()
Reads an 8 bit, unsigned value
|
String |
readUnicodeLEString(int requestedLength)
given a byte array of 16-bit unicode characters, compress to 8-bit and
return a string
{ 0x16, 0x00 } -0x16
|
int |
readUShort()
Reads a 16 bit, unsigned value.
|
int |
remaining()
The remaining number of bytes in the current record.
|
public static final short MAX_RECORD_DATA_SIZE
public RecordInputStream(InputStream in) throws RecordFormatException
RecordFormatException
public RecordInputStream(InputStream in, Biff8EncryptionKey key, int initialOffset) throws RecordFormatException
RecordFormatException
public int available()
available
in interface LittleEndianInput
remaining()
public int read(byte[] b, int off, int len)
public short getSid()
public boolean hasNextRecord() throws RecordInputStream.LeftoverDataException
RecordInputStream.LeftoverDataException
- if this method is called before reaching the end of the
current record.public void nextRecord() throws RecordFormatException
RecordFormatException
public byte readByte()
readByte
in interface LittleEndianInput
public short readShort()
readShort
in interface LittleEndianInput
public int readInt()
readInt
in interface LittleEndianInput
public long readLong()
readLong
in interface LittleEndianInput
public int readUByte()
readUByte
in interface LittleEndianInput
public int readUShort()
readUShort
in interface LittleEndianInput
public double readDouble()
readDouble
in interface LittleEndianInput
public void readFully(byte[] buf)
readFully
in interface LittleEndianInput
public void readFully(byte[] buf, int off, int len)
readFully
in interface LittleEndianInput
public String readString()
public String readUnicodeLEString(int requestedLength)
requestedLength
- the length of the final stringIllegalArgumentException
- if len is too large (i.e.,
there is not enough data in string to create a String of that
length)public String readCompressedUnicode(int requestedLength)
public byte[] readRemainder()
public byte[] readAllContinuedRemainder()
public int remaining()
public int getNextSid()
Copyright © 2020. All rights reserved.