|
GXPARSE hosted by |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.Writer
ca.gorman.io.WriterStack
ca.gorman.io.ResequencingWriterStack<K>
public class ResequencingWriterStack<K>
A WriterStack that acts as a
Resequencer when the Writer at
top of stack is a Resequencer.
ResequencingWriterStack violates the
Writer contract because a Resequencer cannot
be flushed.
ResequencingWriterStack violates the
Resequencer contract because some Resequencer
methods will throw
ClassCastException when the current
Writer is not a Resequencer.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface ca.gorman.io.Resequencer |
|---|
Resequencer.Buffer<K>, Resequencer.Mark<K>, Resequencer.MarkGroup<K>, Resequencer.SpillBuffer |
| Field Summary |
|---|
| Fields inherited from class java.io.Writer |
|---|
lock |
| Constructor Summary | |
|---|---|
ResequencingWriterStack(ResequencingWriter<K> resequencingWriter)
Construct new ResequencingWriterStack on a
ResequencingWriter. |
|
| Method Summary | |
|---|---|
void |
flush()
Flush the WriterStack. |
Resequencer.Mark<K> |
getMark(K key)
Get an existing Mark. |
Resequencer.MarkGroup<K> |
getMarkGroup()
Get the MarkGroup used by this Resequencer. |
boolean |
isFlushThrowsException()
Always returns false. |
Resequencer.Mark<K> |
mark()
Create a Mark without a key. |
Resequencer.Mark<K> |
mark(K key)
Get the Mark for a specific key, creating a new
Mark if one does not already exist. |
void |
push(ResequencingWriter<K> writer)
Push a ResequencingWriter on the ResequencingWriterStack. |
void |
setFlushThrowsException(boolean b)
Unsupported operation. |
void |
write(Resequencer.Mark<K> mark)
Write a |
void |
writeMark(K key)
Write a |
| Methods inherited from class ca.gorman.io.WriterStack |
|---|
close, isEmpty, peek, pop, push, size, write, write, write, write, write |
| Methods inherited from class java.io.Writer |
|---|
append, append, append |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ResequencingWriterStack(ResequencingWriter<K> resequencingWriter)
Construct new ResequencingWriterStack on a
ResequencingWriter.
NullPointerException - when writer is null;| Method Detail |
|---|
public void push(ResequencingWriter<K> writer)
throws IOException
Push a ResequencingWriter on the ResequencingWriterStack. The Writer currently at top of stack will be flushed before the new Writer is pushed.
The new Writer becomes the output destination, until the previous destination is restored by popping the new Writer.
NullPointerException - when writer is null;
IOException - if the Writer previously at top of stack throws
the exception when flushed.
IllegalArgumentException - when the ResequencingWriter does not
have the same MarkGroup as the ResequencingWriterStack.public Resequencer.MarkGroup<K> getMarkGroup()
Resequencer
Get the MarkGroup used by this Resequencer.
getMarkGroup in interface Resequencer<K>public Resequencer.Mark<K> getMark(K key)
Resequencer
Get an existing Mark.
This method should be delegated to the Buffer that supports the Resequencer.
getMark in interface Resequencer<K>public Resequencer.Mark<K> mark()
Resequencer
Create a Mark without a key. This method returns a new
Mark each time it is invoked. The only way to obtain the
same Mark again is to assign it to a variable for later
use.
This method should be delegated to the Buffer that supports the Resequencer.
mark in interface Resequencer<K>public Resequencer.Mark<K> mark(K key)
Resequencer
Get the Mark for a specific key, creating a new
Mark if one does not already exist. This method returns
the same Mark each time it is invoked with the same key.
This method should be delegated to the Buffer that supports the Resequencer.
mark in interface Resequencer<K>key - Identifies the mark to be retrieved or created
public void writeMark(K key)
throws IOException
Write a Mark representing data that will be
supplied at some other time, creating a new Mark if one
does not already exist. The Mark will be replaced by data
when this Resequencer is closed.
This method should be delegated to the Buffer that supports the Resequencer..
writeMark in interface Resequencer<K>key - the key that identifies the place mark within the
MarkGroup used by this
Resequencer
ClassCastException - when the Writer at
top of stack is not a Resequencer or
a NullOutputWriter.
IOException
public void write(Resequencer.Mark<K> mark)
throws IOException
Write a Mark representing data that will be supplied at
some other time. The Mark will be replaced by data when
this Resequencer is closed.
This method should be delegated to the Buffer that supports the Resequencer..
write in interface Resequencer<K>mark - The Mark to be written,
ClassCastException - when the Writer at
top of stack is not a Resequencer or
a NullOutputWriter.
IOException
public void flush()
throws IOException
WriterStackFlush the WriterStack.
Writers below the top of stack are already flushed by
the push operation, so only the top
Writer will be flushed.
flush in interface Flushableflush in class WriterStackIOExceptionpublic boolean isFlushThrowsException()
Always returns false.
Indicate whether flush will
throw UnsupportedOperationException or fail silently (the default).
A Resequencer cannot be flushed because it retains all data
until the supporting Writer is closed..
isFlushThrowsException in interface Resequencer<K>flush will throw
UnsupportedOperationException, false if flush
will be ignored.Resequencer.setFlushThrowsException(boolean)public void setFlushThrowsException(boolean b)
Unsupported operation.
Choose whether flush will throw
UnsupportedOperationException or fail silently (the default).
A Resequencer cannot be flushed because it retains all data
until the supporting Writer is closed..
setFlushThrowsException in interface Resequencer<K>b - true to throw UnsupportedOperationException,
false (default) to simply ignore
flush.
UnsupportedOperationException - when invoked.Resequencer.isFlushThrowsException()
|
GXPARSE download | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||