GXPARSE hosted by SourceForge.net Logo

ca.gorman.io
Class Resequencer.Mark<K>

java.lang.Object
  extended by java.io.Writer
      extended by ca.gorman.io.Resequencer.Mark<K>
All Implemented Interfaces:
Closeable, Flushable, Appendable
Enclosing interface:
Resequencer<K>

public abstract static class Resequencer.Mark<K>
extends Writer

Associates data with a key of type K and contains other internal data to support efficient operation.


Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
protected Resequencer.Mark(Resequencer.MarkGroup<K> markGroup, K key, int index)
           Create a Mark instance with its identifiers (key and index), and the MarkGroup that owns it.
 
Method Summary
 void close()
           Close the stream, flushing it first.
 void flush()
           Flush the stream.
 int getIndex()
           Get the index of this Mark in its MarkGroup.
 K getKey()
           Get the key of this Mark in its MarkGroup.
protected  Resequencer.MarkGroup<K> getMarkGroup()
           Get the MarkGroup that owns this Mark.
 void reset()
           Restores the Mark to its initial empty state.
 char[] toCharArray()
           Returns a copy of the characters stored in the Mark.
 String toString()
           Returns a copy of the characters stored in the Mark.
 void write(char[] cbuf, int off, int len)
           Write a portion of an array of characters to the Mark.
 void writeTo(Writer out)
           Writes the contents of the Mark to another character stream.
 
Methods inherited from class java.io.Writer
append, append, append, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Resequencer.Mark

protected Resequencer.Mark(Resequencer.MarkGroup<K> markGroup,
                           K key,
                           int index)

Create a Mark instance with its identifiers (key and index), and the MarkGroup that owns it. A Mark can only belong to one MarkGroup.

Parameters:
key - The key to be used in the map
markGroup - The MarkGroup that is creating (and will own) this Mark
index - The index of the Mark in the MarkGroup
Method Detail

getMarkGroup

protected Resequencer.MarkGroup<K> getMarkGroup()

Get the MarkGroup that owns this Mark.


getKey

public K getKey()

Get the key of this Mark in its MarkGroup.


getIndex

public int getIndex()

Get the index of this Mark in its MarkGroup. This method is used when replacing marked points by the data associated with the Mark..


reset

public void reset()

Restores the Mark to its initial empty state.


toCharArray

public char[] toCharArray()

Returns a copy of the characters stored in the Mark.


toString

public String toString()

Returns a copy of the characters stored in the Mark.

Overrides:
toString in class Object

writeTo

public void writeTo(Writer out)
             throws IOException

Writes the contents of the Mark to another character stream. The contents of the Mark are not altered by this method.

Throws:
IOException

flush

public void flush()
           throws IOException

Flush the stream.

Specified by:
flush in interface Flushable
Specified by:
flush in class Writer
Throws:
IOException

close

public void close()
           throws IOException

Close the stream, flushing it first.

Specified by:
close in interface Closeable
Specified by:
close in class Writer
Throws:
IOException

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws IOException

Write a portion of an array of characters to the Mark.

Specified by:
write in class Writer
Throws:
IOException

GXPARSE download

GXPARSE Generic XML Stream Parser API and supporting tools.   Release $Name: gxparse-sf-alpha-2_0 $
Copyright 2003-2004 Ian E. Gorman
Released under GNU Lesser General Public License