net.kano.joscar
Interface Writable

All Superinterfaces:
LiveWritable
All Known Subinterfaces:
MutableTlvChain, TlvChain
All Known Implementing Classes:
AbstractTlvChain, ByteBlock, CapabilityBlock, DefaultMutableTlvChain, ExtraInfoBlock, ExtraInfoBlockHolder, ExtraInfoData, ParamInfo, RateClassInfo, ShortCapabilityBlock, SnacFamilyInfo, Tlv

public interface Writable
extends LiveWritable

Extends the interface for a LiveWritable to provide an interface for objects which can write themselves in some format or another to a stream and know the length of that data beforehand.


Method Summary
 long getWritableLength()
          Returns the length of the data that was or will be written in a call to write.
 void write(java.io.OutputStream out)
          Writes a representation of this object to the given stream.
 

Method Detail

getWritableLength

public long getWritableLength()
Returns the length of the data that was or will be written in a call to write. The value returned by this method must not change after its first invocation.

Returns:
the length of the data to be written by write

write

public void write(java.io.OutputStream out)
           throws java.io.IOException
Writes a representation of this object to the given stream. The length of the data written by this function must match any value previously returned by getWritableLength.

Specified by:
write in interface LiveWritable
Parameters:
out - the stream to which to write
Throws:
java.io.IOException - if an I/O error occurs