org.apache.poi.hssf.record.cont
Class ContinuableRecordOutput

java.lang.Object
  extended by org.apache.poi.hssf.record.cont.ContinuableRecordOutput
All Implemented Interfaces:
LittleEndianOutput

public final class ContinuableRecordOutput
extends java.lang.Object
implements LittleEndianOutput

An augmented LittleEndianOutput used for serialization of ContinuableRecords. This class keeps track of how much remaining space is available in the current BIFF record and can start new ContinueRecords as required.


Constructor Summary
ContinuableRecordOutput(LittleEndianOutput out, int sid)
           
 
Method Summary
static ContinuableRecordOutput createForCountingOnly()
           
 int getAvailableSpace()
           
 int getTotalSize()
           
 void write(byte[] b)
           
 void write(byte[] b, int offset, int len)
           
 void writeByte(int v)
           
 void writeContinue()
          Terminates the current record and starts a new ContinueRecord (regardless of how much space is still available in the current record).
 void writeContinueIfRequired(int requiredContinuousSize)
          Will terminate the current record and start a new ContinueRecord if there isn't space for the requested number of bytes
 void writeDouble(double v)
           
 void writeInt(int v)
           
 void writeLong(long v)
           
 void writeShort(int v)
           
 void writeString(java.lang.String text, int numberOfRichTextRuns, int extendedDataSize)
          Writes a unicode string complete with header and character data.
 void writeStringData(java.lang.String text)
          Writes the 'optionFlags' byte and encoded character data of a unicode string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContinuableRecordOutput

public ContinuableRecordOutput(LittleEndianOutput out,
                               int sid)
Method Detail

createForCountingOnly

public static ContinuableRecordOutput createForCountingOnly()

getTotalSize

public int getTotalSize()
Returns:
total number of bytes written so far (including all BIFF headers)

getAvailableSpace

public int getAvailableSpace()
Returns:
number of remaining bytes of space in current record

writeContinue

public void writeContinue()
Terminates the current record and starts a new ContinueRecord (regardless of how much space is still available in the current record).


writeContinueIfRequired

public void writeContinueIfRequired(int requiredContinuousSize)
Will terminate the current record and start a new ContinueRecord if there isn't space for the requested number of bytes

Parameters:
requiredContinuousSize - The number of bytes that need to be written

writeStringData

public void writeStringData(java.lang.String text)
Writes the 'optionFlags' byte and encoded character data of a unicode string. This includes: Notes:


writeString

public void writeString(java.lang.String text,
                        int numberOfRichTextRuns,
                        int extendedDataSize)
Writes a unicode string complete with header and character data. This includes: The following bits of the 'optionFlags' byte will be set as appropriate:
MaskDescription
0x01is16bitEncoded
0x04hasExtendedData
0x08isRichText
Notes:


write

public void write(byte[] b)
Specified by:
write in interface LittleEndianOutput

write

public void write(byte[] b,
                  int offset,
                  int len)
Specified by:
write in interface LittleEndianOutput

writeByte

public void writeByte(int v)
Specified by:
writeByte in interface LittleEndianOutput

writeDouble

public void writeDouble(double v)
Specified by:
writeDouble in interface LittleEndianOutput

writeInt

public void writeInt(int v)
Specified by:
writeInt in interface LittleEndianOutput

writeLong

public void writeLong(long v)
Specified by:
writeLong in interface LittleEndianOutput

writeShort

public void writeShort(int v)
Specified by:
writeShort in interface LittleEndianOutput