FileDocCategorySizeDatePackage
TextCharsAtom.javaAPI DocApache Poi 3.0.12790Mon Jan 01 18:55:34 GMT 2007org.apache.poi.hslf.record

TextCharsAtom

public class TextCharsAtom extends RecordAtom
A TextCharsAtom (type 4000). Holds text in byte swapped unicode form. The trailing return character is always stripped from this
author
Nick Burch

Fields Summary
private byte[]
_header
private static long
_type
private byte[]
_text
The bytes that make up the text
Constructors Summary
protected TextCharsAtom(byte[] source, int start, int len)
For the TextChars 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 TextCharsAtom()
Create an empty TextCharsAtom

		// 0 length header
		_header = new byte[] {  0, 0, 0xA0-256, 0x0f, 0, 0, 0, 0 };
		// Empty text
		_text = new byte[0];
	
Methods Summary
public longgetRecordType()
We are of type 4000

 return _type; 
public java.lang.StringgetText()
Grabs the text.


	    
	    
		return StringUtil.getFromUnicodeLE(_text);
	
public voidsetText(java.lang.String text)
Updates the text in the Atom.

		// Convert to little endian unicode
		_text = new byte[text.length()*2];
		StringUtil.putUnicodeLE(text,_text,0);

		// Update the size (header bytes 5-8)
		LittleEndian.putInt(_header,4,_text.length);
	
public voidwriteOut(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);