org.planx.io
Class Locator.CompactStreamer

java.lang.Object
  extended by org.planx.io.Locator.CompactStreamer
All Implemented Interfaces:
SizeStreamer<Locator>, Streamer<Locator>
Enclosing class:
Locator

public static class Locator.CompactStreamer
extends Object
implements SizeStreamer<Locator>

A Streamer capable of converting a Locator to and from byte representation. The streamer can also write locators in a compact manner for a specific SourceId. That is, by calling setCompactId(SourceId) an id can be set such that all locators with this SourceId will not have their ids written in the byte representation (all others will). Thus, these locators are written in a very compact way. However, in order to be able to read them back-in the original SourceId must of course be known.


Constructor Summary
Locator.CompactStreamer()
           
Locator.CompactStreamer(SourceId id)
           
 
Method Summary
 Locator fromStream(DataInput in)
          Reads an object of class E from the data source.
 SourceId getCompactId()
           
 void setCompactId(SourceId id)
           
 long size(Locator l)
          Returns the number of bytes that this Streamer will write when the toStream method is invoked on the specified object.
 void toStream(DataOutput out, Locator l)
          Writes the internal state of the object to the data source in a format that can later be read by the same Streamer using the fromStream method.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Locator.CompactStreamer

public Locator.CompactStreamer()

Locator.CompactStreamer

public Locator.CompactStreamer(SourceId id)
Method Detail

setCompactId

public void setCompactId(SourceId id)

getCompactId

public SourceId getCompactId()

size

public long size(Locator l)
          throws IOException
Description copied from interface: SizeStreamer
Returns the number of bytes that this Streamer will write when the toStream method is invoked on the specified object.

Specified by:
size in interface SizeStreamer<Locator>
Throws:
IOException

toStream

public void toStream(DataOutput out,
                     Locator l)
              throws IOException
Description copied from interface: Streamer
Writes the internal state of the object to the data source in a format that can later be read by the same Streamer using the fromStream method.

Specified by:
toStream in interface Streamer<Locator>
Throws:
IOException

fromStream

public Locator fromStream(DataInput in)
                   throws IOException
Description copied from interface: Streamer
Reads an object of class E from the data source.

Specified by:
fromStream in interface Streamer<Locator>
Throws:
IOException


Copyright © 2004-2005 Plan-X. All Rights Reserved.