TextBytesAtompublic class TextBytesAtom extends RecordAtom A TextBytesAtom (type 4008). Holds text in ascii form (unknown
code page, for now assumed to be the default of
org.apache.poi.util.StringUtil, which is the Excel default).
The trailing return character is always stripped from this |
Fields Summary |
---|
private byte[] | _header | private static long | _type | private byte[] | _textThe bytes that make up the text |
Constructors Summary |
---|
protected TextBytesAtom(byte[] source, int start, int len)For the TextBytes Atom
// Sanity Checking
if(len < 8) { len = 8; }
// Get the header
_header = new byte[8];
System.arraycopy(source,start,_header,0,8);
// Grab the text
_text = new byte[len-8];
System.arraycopy(source,start+8,_text,0,len-8);
| public TextBytesAtom()Create an empty TextBytes Atom
_header = new byte[8];
LittleEndian.putUShort(_header, 0, 0);
LittleEndian.putUShort(_header, 2, (int)_type);
LittleEndian.putInt(_header, 4, 0);
_text = new byte[]{};
|
Methods Summary |
---|
public long | getRecordType()We are of type 4008 return _type;
| public java.lang.String | getText()Grabs the text. Uses the default codepage
return StringUtil.getFromCompressedUnicode(_text,0,_text.length);
| public void | setText(byte[] b)Updates the text in the Atom. Must be 8 bit ascii
// Set the text
_text = b;
// Update the size (header bytes 5-8)
LittleEndian.putInt(_header,4,_text.length);
| public void | writeOut(java.io.OutputStream out)Write the contents of the record back, so it can be written
to disk
// Header - size or type unchanged
out.write(_header);
// Write out our text
out.write(_text);
|
|