Top Description Fields Constructors Methods
org.apache.poi.hssf.record.cont

public final Class ContinuableRecordOutput

extends Object
implements LittleEndianOutput
Class Inheritance
All Implemented Interfaces
org.apache.poi.util.LittleEndianOutput
Imports
org.apache.poi.hssf.record.ContinueRecord, org.apache.poi.util.DelayableLittleEndianOutput, .LittleEndianOutput, .StringUtil

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.

Field Summary

Modifier and TypeField and Description
private final LittleEndianOutput
private int
private UnknownLengthRecordOutput
private static final LittleEndianOutput
NOPOutput

Allows optimised usage of ContinuableRecordOutput for sizing purposes only.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static ContinuableRecordOutput
public int

Returns:

number of remaining bytes of space in current record
getAvailableSpace
()

public int

Returns:

total number of bytes written so far (including all BIFF headers)
getTotalSize
()

pack-priv void
terminate()

Terminates the last record (also updates its 'ushort size' field)

public void
public void
write(byte[] b, int offset, int len)

Implements org.apache.poi.util.LittleEndianOutput.write.

public void
private void
writeCharacterData(String text, boolean is16bitEncoded)

public void
writeContinue()

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

public void
writeContinueIfRequired(int
The number of bytes that need to be written
requiredContinuousSize
)

Will terminate the current record and start a new ContinueRecord if there isn't space for the requested number of bytes

public void
public void
public void
public void
public void
writeString(String text, int numberOfRichTextRuns, int extendedDataSize)

Writes a unicode string complete with header and character data.

public void
writeStringData(String text)

Writes the 'optionFlags' byte and encoded character data of a unicode string.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_outback to summary
private final LittleEndianOutput _out
_totalPreviousRecordsSizeback to summary
private int _totalPreviousRecordsSize
_ulrOutputback to summary
private UnknownLengthRecordOutput _ulrOutput
NOPOutputback to summary
private static final LittleEndianOutput NOPOutput

Allows optimised usage of ContinuableRecordOutput for sizing purposes only.

Constructor Detail

ContinuableRecordOutputback to summary
public ContinuableRecordOutput(LittleEndianOutput out, int sid)

Method Detail

createForCountingOnlyback to summary
public static ContinuableRecordOutput createForCountingOnly()
getAvailableSpaceback to summary
public int getAvailableSpace()
Returns:int

number of remaining bytes of space in current record

getTotalSizeback to summary
public int getTotalSize()
Returns:int

total number of bytes written so far (including all BIFF headers)

terminateback to summary
pack-priv void terminate()

Terminates the last record (also updates its 'ushort size' field)

writeback to summary
public void write(byte[] b)

Implements org.apache.poi.util.LittleEndianOutput.write.

Annotations
@Override
writeback to summary
public void write(byte[] b, int offset, int len)

Implements org.apache.poi.util.LittleEndianOutput.write.

Annotations
@Override
writeByteback to summary
public void writeByte(int v)

Implements org.apache.poi.util.LittleEndianOutput.writeByte.

Annotations
@Override
writeCharacterDataback to summary
private void writeCharacterData(String text, boolean is16bitEncoded)
writeContinueback to summary
public void writeContinue()

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

writeContinueIfRequiredback to summary
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:int

The number of bytes that need to be written

writeDoubleback to summary
public void writeDouble(double v)

Implements org.apache.poi.util.LittleEndianOutput.writeDouble.

Annotations
@Override
writeIntback to summary
public void writeInt(int v)

Implements org.apache.poi.util.LittleEndianOutput.writeInt.

Annotations
@Override
writeLongback to summary
public void writeLong(long v)

Implements org.apache.poi.util.LittleEndianOutput.writeLong.

Annotations
@Override
writeShortback to summary
public void writeShort(int v)

Implements org.apache.poi.util.LittleEndianOutput.writeShort.

Annotations
@Override
writeStringback to summary
public void writeString(String text, int numberOfRichTextRuns, int extendedDataSize)

Writes a unicode string complete with header and character data. This includes:

  • ushort length
  • byte optionFlags
  • ushort numberOfRichTextRuns (optional)
  • ushort extendedDataSize (optional)
  • encoded character data (in "ISO-8859-1" or "UTF-16LE" encoding)
The following bits of the 'optionFlags' byte will be set as appropriate:
bits of the 'optionFlags'
MaskDescription
0x01is16bitEncoded
0x04hasExtendedData
0x08isRichText
Notes:
  • The value of the 'is16bitEncoded' flag is determined by the actual character data of text
  • The string header fields are never separated (by a ContinueRecord) from the first chunk of character data (i.e. the first character is always encoded in the same record as the string header).
writeStringDataback to summary
public void writeStringData(String text)

Writes the 'optionFlags' byte and encoded character data of a unicode string. This includes:

  • byte optionFlags
  • encoded character data (in "ISO-8859-1" or "UTF-16LE" encoding)
Notes:
  • The value of the 'is16bitEncoded' flag is determined by the actual character data of text
  • The string options flag is never separated (by a ContinueRecord) from the first chunk of character data it refers to.
  • The 'ushort length' field is assumed to have been explicitly written earlier. Hence, there may be an intervening ContinueRecord