things.data.processing
Class Decomposer

java.lang.Object
  extended by things.data.processing.Decomposer

public class Decomposer
extends java.lang.Object

General decomposer.

Version:
1.0

Version History

EPG - Adapted from autohit - 22 OCT 06
 
Author:
Erich P. Gatejen

Field Summary
static java.lang.String DEFAULT_DELIMITERS
          The default delimiter characters in a string.
 
Constructor Summary
Decomposer()
           
 
Method Summary
 void done()
          Done.
protected  void finalize()
          Finalizer.
 int getLineNumber()
          Get the current line number.
 boolean hasmore()
          Return "true" if there are more tokens and/or lines, else "false."
 java.lang.String line()
          Return the next line.
 java.lang.String nonbreaking_token()
          Return the next token from the current line.
 java.lang.String peekLine()
          Look at the current line.
 void start(java.io.InputStream ios)
          Start a decomposition on an Input Stream using default delimiters.
 void start(java.io.InputStream ios, java.lang.String delimiters)
          Start a decomposition on an Input Stream using specified delimiters.
 java.lang.String token()
          Return the next token.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DELIMITERS

public static final java.lang.String DEFAULT_DELIMITERS
The default delimiter characters in a string.

See Also:
Constant Field Values
Constructor Detail

Decomposer

public Decomposer()
Method Detail

start

public void start(java.io.InputStream ios,
                  java.lang.String delimiters)
           throws java.lang.Throwable
Start a decomposition on an Input Stream using specified delimiters. If a prior session has been started, it will dump it.

Parameters:
ios - the input stream. It will be closed by this class when it is done with it. Done is either explicitly stated (with done()), the object is finalized, or you start() a new session.
delimiters - the delimiters used to decompose tokens. If null, the default will be used, which is SPACE, TAB, CF, LF, and FORM FEED.
Throws:
java.lang.Throwable

start

public void start(java.io.InputStream ios)
           throws java.lang.Throwable
Start a decomposition on an Input Stream using default delimiters. If a prior session has been started, it will dump it.

Parameters:
ios - the input stream. It will be closed by this class when it is done with it. Done is either explicitly stated (with done()), the object is finalized, or you start() a new session.
Throws:
java.lang.Throwable

line

public java.lang.String line()
Return the next line. If there is no next line or no session has been started, it will return a null.

Returns:
the next line or null

peekLine

public java.lang.String peekLine()
Look at the current line. If there is no next line or no session has been started, it will return a null.

Returns:
the next line or null

token

public java.lang.String token()
Return the next token. If there is no next token or no session has been started, it will return a null.

Returns:
the next token or a null

nonbreaking_token

public java.lang.String nonbreaking_token()
Return the next token from the current line. If there is no next token or no session has been started, it will return null.

Returns:
the next token or a null

hasmore

public boolean hasmore()
Return "true" if there are more tokens and/or lines, else "false."

Returns:
"true" if there is more, otherwise "false"

done

public void done()
Done. The source will be closed. All errors will be eaten.


getLineNumber

public int getLineNumber()
Get the current line number.

Returns:
the current line number.

finalize

protected void finalize()
                 throws java.lang.Throwable
Finalizer. Just so we can close stuff like we promised.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - but it will not ever happen.


Things.