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

ExHyperlinkAtom

public class ExHyperlinkAtom extends RecordAtom
Tne atom that holds metadata on a specific Link in the document. (The actual link is held in a sibling CString record)
author
Nick Burch

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

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

        LittleEndian.putShort(_header, 2, (short)getRecordType());
        LittleEndian.putInt(_header, 4, _data.length);
        
        // It is fine for the other values to be zero
    
protected ExHyperlinkAtom(byte[] source, int start, int len)
Constructs the link related 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);
        
        // Must be at least 4 bytes long
        if(_data.length < 4) {
        	throw new IllegalArgumentException("The length of the data for a ExHyperlinkAtom must be at least 4 bytes, but was only " + _data.length);
        }
    
Methods Summary
public intgetNumber()
Gets the link number. This will match the one in the InteractiveInfoAtom which uses the link.

return
the link number

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

return
the record type.

 return RecordTypes.ExHyperlinkAtom.typeID; 
public voidsetNumber(int number)
Sets the link number

param
number the link number.

        LittleEndian.putInt(_data,0,number);
    
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);