Jacson

de.spieleck.app.jacson.source
Class LineChunkSource

java.lang.Object
  extended byde.spieleck.app.jacson.PluginBase
      extended byde.spieleck.app.jacson.source.ChunkSourceBase
          extended byde.spieleck.app.jacson.source.LineChunkSource
All Implemented Interfaces:
JacsonChunkSource, JacsonReporting, JacsonStately
Direct Known Subclasses:
GenericLineChunkSource, OCRSource

public class LineChunkSource
extends ChunkSourceBase

Simplest possible Source: Reads a file and generates a chunk for every single line read. The only "major" feature: gzipped files are automagically unpacked while reading. This has proved to be quite useful for weblos, since those can be large and compress well..

Author:
fsn

Field Summary
protected  int chunks
           
protected  java.lang.String fileName
           
protected  java.io.BufferedReader in
           
 
Constructor Summary
LineChunkSource()
           
LineChunkSource(java.io.InputStream is, boolean ungzip)
           
LineChunkSource(java.lang.String fileName, boolean ungzip)
           
 
Method Summary
 java.lang.String message()
           
 java.lang.String nextChunk()
          Deliver a sequence of chunks (that is Strings).
 void setReader(java.io.Reader ir)
           
 void setStream(java.io.InputStream is)
           
 void setStream(java.io.InputStream is, boolean ungzip)
           
 void summary()
          Do nothing default implementation
static java.io.InputStream unwrapGZIP(java.io.InputStream is)
           
 
Methods inherited from class de.spieleck.app.jacson.PluginBase
getRegReport, getRegState, registerReport, registerState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.spieleck.app.jacson.JacsonStately
registerState
 
Methods inherited from interface de.spieleck.app.jacson.JacsonReporting
registerReport
 

Field Detail

fileName

protected java.lang.String fileName

in

protected java.io.BufferedReader in

chunks

protected int chunks
Constructor Detail

LineChunkSource

public LineChunkSource()

LineChunkSource

public LineChunkSource(java.lang.String fileName,
                       boolean ungzip)
                throws JacsonException

LineChunkSource

public LineChunkSource(java.io.InputStream is,
                       boolean ungzip)
                throws JacsonException
Method Detail

setStream

public void setStream(java.io.InputStream is)
               throws JacsonException
Throws:
JacsonException

setStream

public void setStream(java.io.InputStream is,
                      boolean ungzip)
               throws JacsonException
Throws:
JacsonException

setReader

public void setReader(java.io.Reader ir)

nextChunk

public java.lang.String nextChunk()
                           throws JacsonException
Description copied from interface: JacsonChunkSource
Deliver a sequence of chunks (that is Strings).

Returns:
The next String if available, null if sequence is finished.
Throws:
JacsonException

message

public java.lang.String message()

summary

public void summary()
Description copied from class: PluginBase
Do nothing default implementation

Specified by:
summary in interface JacsonReporting
Overrides:
summary in class PluginBase

unwrapGZIP

public static java.io.InputStream unwrapGZIP(java.io.InputStream is)
                                      throws java.io.IOException
Throws:
java.io.IOException

Spieleck

Copyleft 2002 spieleck.de.