TextCharsAtompublic class TextCharsAtom extends RecordAtom A TextCharsAtom (type 4000). Holds text in byte swapped unicode form.
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 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 long | getRecordType()We are of type 4000 return _type;
| public java.lang.String | getText()Grabs the text.
return StringUtil.getFromUnicodeLE(_text);
| public void | setText(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 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);
|
|