FileDocCategorySizeDatePackage
Comment2000Atom.javaAPI DocApache Poi 3.0.14408Sun Mar 11 12:59:30 GMT 2007org.apache.poi.hslf.record

Comment2000Atom

public class Comment2000Atom extends RecordAtom
An atomic record containing information about a comment.
author
Daniel Noll

Fields Summary
private byte[]
_header
Record header.
private byte[]
_data
Record data.
Constructors Summary
protected Comment2000Atom()
Constructs a brand new comment atom record.

        _header = new byte[8];
        _data = new byte[28];

        LittleEndian.putShort(_header, 2, (short)getRecordType());
        LittleEndian.putInt(_header, 4, _data.length);
        
        // It is fine for the other values to be zero
    
protected Comment2000Atom(byte[] source, int start, int len)
Constructs the comment atom record from its source data.

param
source the source data as a byte array.
param
start the start offset into the byte array.
param
len the length of the slice in the byte array.

        // Get the header.
        _header = new byte[8];
        System.arraycopy(source,start,_header,0,8);
        
        // Get the record data.
        _data = new byte[len-8];
        System.arraycopy(source,start+8,_data,0,len-8);
    
Methods Summary
public java.util.DategetDate()
Gets the date the comment was made.

return
the comment date.

    	return SystemTimeUtils.getDate(_data,4);
    
public intgetNumber()
Gets the comment number (note - each user normally has their own count).

return
the comment number.

        return LittleEndian.getInt(_data,0);
    
public longgetRecordType()
Gets the record type.

return
the record type.

 return RecordTypes.Comment2000Atom.typeID; 
public intgetXOffset()
Gets the X offset of the comment on the page.

return
the X offset.

        return LittleEndian.getInt(_data,20);
    
public intgetYOffset()
Gets the Y offset of the comment on the page.

return
the Y offset.

        return LittleEndian.getInt(_data,24);
    
public voidsetDate(java.util.Date date)
Sets the date the comment was made.

param
date the comment date.

    	SystemTimeUtils.storeDate(date, _data, 4);
    
public voidsetNumber(int number)
Sets the comment number (note - each user normally has their own count).

param
number the comment number.

        LittleEndian.putInt(_data,0,number);
    
public voidsetXOffset(int xOffset)
Sets the X offset of the comment on the page.

param
xOffset the X offset.

        LittleEndian.putInt(_data,20,xOffset);
    
public voidsetYOffset(int yOffset)
Sets the Y offset of the comment on the page.

param
yOffset the Y offset.

        LittleEndian.putInt(_data,24,yOffset);
    
public voidwriteOut(java.io.OutputStream out)
Write the contents of the record back, so it can be written to disk

param
out the output stream to write to.
throws
IOException if an error occurs.

        out.write(_header);
        out.write(_data);