sdsu.io
Class ChunkWriter
java.lang.Object
|
+--java.io.Writer
|
+--java.io.FilterWriter
|
+--sdsu.io.ChunkWriter
- public class ChunkWriter
- extends java.io.FilterWriter
A chunk is any sequence of characters you wish. A chunk could be a
single line, a table, or a complete document. The ChunkWriter
separates chunks with a string separator, called a chunk seperator.
This allows other classes (ChunkReader for example) to determine
where one chunk ends and another begins. Currently the ChunkWriter
does not check chunks for occurences of the chunk separator,
so select seperator strings that will not occur in your chunks.
Future versions of the ChunkWriter will escape occurances of the
seperator in the chunk.
The writeChunk methods will end a chunk. All other writes methods
(inherited from FilterWriter) add to the current chunk.
- Version:
- 0.5 7 January 1998
- Author:
- Roger Whitney
(whitney@cs.sdsu.edu)
Constructor Summary |
ChunkWriter(java.io.Writer out,
java.lang.String chunkSeparator)
Create a new ChunkWriter |
Method Summary |
void |
setChunkSeparator(java.lang.String newSeparator)
|
void |
writeChunk()
Writes the chunkSeperator to end the current chunk |
void |
writeChunk(java.lang.String chunk)
Writes the string chunk and a chunkSeperator to end
the current chunk |
Methods inherited from class java.io.FilterWriter |
close,
flush,
write,
write,
write |
Methods inherited from class java.io.Writer |
write,
write |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ChunkWriter
public ChunkWriter(java.io.Writer out,
java.lang.String chunkSeparator)
- Create a new ChunkWriter
- Parameters:
out
- Writer the ChunkWriter will writer tochunkSeparator
- The string that will placed between chunks.
chunkSeparator should be at least two characters. Select a string
that is not likely to occur in your chunks.
setChunkSeparator
public void setChunkSeparator(java.lang.String newSeparator)
writeChunk
public void writeChunk(java.lang.String chunk)
throws java.io.IOException
- Writes the string chunk and a chunkSeperator to end
the current chunk
writeChunk
public void writeChunk()
throws java.io.IOException
- Writes the chunkSeperator to end the current chunk