org.aspectj.org.eclipse.jdt.internal.formatter.comment
Class SubstitutionTextReader

java.lang.Object
  extended by java.io.Reader
      extended by org.aspectj.org.eclipse.jdt.internal.formatter.comment.SubstitutionTextReader
All Implemented Interfaces:
java.io.Closeable, java.lang.Readable
Direct Known Subclasses:
HTMLEntity2JavaReader, Java2HTMLEntityReader

public abstract class SubstitutionTextReader
extends java.io.Reader

Reads the text contents from a reader and computes for each character a potential substitution. The substitution may eat more characters than only the one passed into the computation routine.


Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
protected SubstitutionTextReader(java.io.Reader reader)
           
 
Method Summary
 void close()
           
protected abstract  java.lang.String computeSubstitution(int c)
          Implement to compute the substitution for the given character and if necessary subsequent characters.
protected  java.io.Reader getReader()
          Returns the internal reader.
 java.lang.String getString()
          Gets the content as a String
protected  boolean isSkippingWhitespace()
           
protected  int nextChar()
          Returns the next character.
 int read()
           
 int read(char[] cbuf, int off, int len)
           
 boolean ready()
           
 void reset()
           
protected  void setSkipWhitespace(boolean state)
           
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubstitutionTextReader

protected SubstitutionTextReader(java.io.Reader reader)
Method Detail

getString

public java.lang.String getString()
                           throws java.io.IOException
Gets the content as a String

Throws:
java.io.IOException

computeSubstitution

protected abstract java.lang.String computeSubstitution(int c)
                                                 throws java.io.IOException
Implement to compute the substitution for the given character and if necessary subsequent characters. Use nextChar to read subsequent characters.

Throws:
java.io.IOException

getReader

protected java.io.Reader getReader()
Returns the internal reader.


nextChar

protected int nextChar()
                throws java.io.IOException
Returns the next character.

Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Overrides:
read in class java.io.Reader
Throws:
java.io.IOException

read

public int read(char[] cbuf,
                int off,
                int len)
         throws java.io.IOException
Specified by:
read in class java.io.Reader
Throws:
java.io.IOException

ready

public boolean ready()
              throws java.io.IOException
Overrides:
ready in class java.io.Reader
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Reader
Throws:
java.io.IOException

reset

public void reset()
           throws java.io.IOException
Overrides:
reset in class java.io.Reader
Throws:
java.io.IOException

setSkipWhitespace

protected final void setSkipWhitespace(boolean state)

isSkippingWhitespace

protected final boolean isSkippingWhitespace()