Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

openfuture.util.misc
Class StripWhitespaceReader  view StripWhitespaceReader download StripWhitespaceReader.java

java.lang.Object
  extended byjava.io.Reader
      extended byjava.io.FilterReader
          extended byopenfuture.util.misc.StripWhitespaceReader

public class StripWhitespaceReader
extends java.io.FilterReader

Reader stripping multiple whitespace characters.

Created: Wed May 02 18:45:53 2001

Version:
$Revision: 1.1.1.1 $

Field Summary
protected  boolean cachedChar
          True, if a character has been chached in nextChar 55 .
protected  int nextChar
          We have to read one non whitespace character ahead in order to trim trailing whitespace.
protected  boolean omitWhitespace
          True, if a separator occured such that no whitespace is necessary.
private  char[] separators
          Array of characters that do not require whitespace.
 
Fields inherited from class java.io.FilterReader
in
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
StripWhitespaceReader(java.io.Reader in, char[] separators)
          Creates a new StripWhitespaceReader instance.
 
Method Summary
 char[] getSeparators()
          Get the value of separators.
protected  boolean isSeparator(char c)
          Check, if the given character is a separator.
 int read()
          Read one single character.
 int read(char[] cbuf, int off, int len)
          Read an array of characters merging subsequent whitespaces to a single whitespace using read() 55 .
 void setSeparators(char[] v)
          Set the value of separators.
 long skip(long n)
          Skip n characters where a sequence of whitespace counts as one character.
 
Methods inherited from class java.io.FilterReader
close, mark, markSupported, ready, reset
 
Methods inherited from class java.io.Reader
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextChar

protected int nextChar
We have to read one non whitespace character ahead in order to trim trailing whitespace.


cachedChar

protected boolean cachedChar
True, if a character has been chached in nextChar 55 .


omitWhitespace

protected boolean omitWhitespace
True, if a separator occured such that no whitespace is necessary.


separators

private char[] separators
Array of characters that do not require whitespace.

Constructor Detail

StripWhitespaceReader

public StripWhitespaceReader(java.io.Reader in,
                             char[] separators)
Creates a new StripWhitespaceReader instance.

Method Detail

read

public int read()
         throws java.io.IOException
Read one single character. If the last character read was a whitespace, read() will advance up to the next non-whitespace character.


read

public int read(char[] cbuf,
                int off,
                int len)
         throws java.io.IOException
Read an array of characters merging subsequent whitespaces to a single whitespace using read() 55 .


skip

public long skip(long n)
          throws java.io.IOException
Skip n characters where a sequence of whitespace counts as one character.


isSeparator

protected boolean isSeparator(char c)
Check, if the given character is a separator.


getSeparators

public char[] getSeparators()
Get the value of separators.


setSeparators

public void setSeparators(char[] v)
Set the value of separators.