org.apache.poi.hssf.record.crypto
Class Biff8DecryptingStream

java.lang.Object
  extended by org.apache.poi.hssf.record.crypto.Biff8DecryptingStream
All Implemented Interfaces:
BiffHeaderInput, LittleEndianInput

public final class Biff8DecryptingStream
extends java.lang.Object
implements BiffHeaderInput, LittleEndianInput


Field Summary
static int RC4_REKEYING_INTERVAL
           
 
Constructor Summary
Biff8DecryptingStream(java.io.InputStream in, int initialOffset, EncryptionInfo info)
           
 
Method Summary
 int available()
           
 long getPosition()
           
static boolean isNeverEncryptedRecord(int sid)
          TODO: Additionally, the lbPlyPos (position_of_BOF) field of the BoundSheet8 record MUST NOT be encrypted.
 byte readByte()
           
 int readDataSize()
          Reads an unsigned short value without decrypting
 double readDouble()
           
 void readFully(byte[] buf)
           
 void readFully(byte[] buf, int off, int len)
           
 int readInt()
           
 long readLong()
           
 void readPlain(byte[] b, int off, int len)
          Usually acts the same as LittleEndianInput.readFully(byte[], int, int), but for an encrypted stream the raw (unencrypted) data is filled
 int readRecordSID()
          Reads an unsigned short value without decrypting
 short readShort()
           
 int readUByte()
           
 int readUShort()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RC4_REKEYING_INTERVAL

public static final int RC4_REKEYING_INTERVAL
See Also:
Constant Field Values
Constructor Detail

Biff8DecryptingStream

public Biff8DecryptingStream(java.io.InputStream in,
                             int initialOffset,
                             EncryptionInfo info)
                      throws RecordFormatException
Throws:
RecordFormatException
Method Detail

available

public int available()
Specified by:
available in interface BiffHeaderInput
Specified by:
available in interface LittleEndianInput
Returns:
the available bytes

readRecordSID

public int readRecordSID()
Reads an unsigned short value without decrypting

Specified by:
readRecordSID in interface BiffHeaderInput
Returns:
the record sid

readDataSize

public int readDataSize()
Reads an unsigned short value without decrypting

Specified by:
readDataSize in interface BiffHeaderInput
Returns:
the data size

readDouble

public double readDouble()
Specified by:
readDouble in interface LittleEndianInput

readFully

public void readFully(byte[] buf)
Specified by:
readFully in interface LittleEndianInput

readFully

public void readFully(byte[] buf,
                      int off,
                      int len)
Specified by:
readFully in interface LittleEndianInput

readUByte

public int readUByte()
Specified by:
readUByte in interface LittleEndianInput

readByte

public byte readByte()
Specified by:
readByte in interface LittleEndianInput

readUShort

public int readUShort()
Specified by:
readUShort in interface LittleEndianInput

readShort

public short readShort()
Specified by:
readShort in interface LittleEndianInput

readInt

public int readInt()
Specified by:
readInt in interface LittleEndianInput

readLong

public long readLong()
Specified by:
readLong in interface LittleEndianInput

getPosition

public long getPosition()
Returns:
the absolute position in the stream

isNeverEncryptedRecord

public static boolean isNeverEncryptedRecord(int sid)
TODO: Additionally, the lbPlyPos (position_of_BOF) field of the BoundSheet8 record MUST NOT be encrypted.

Returns:
true if record type specified by sid is never encrypted

readPlain

public void readPlain(byte[] b,
                      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:
b - the byte array to receive the bytes
off - the start offset into the byte array
len - the amount of bytes to fill