org.enhydra.xml.xmlc.misc
Class SSIParsedStream

java.lang.Object
  |
  +--org.enhydra.xml.xmlc.misc.SSIParsedStream

final class SSIParsedStream
extends Object

Implements the reading and parsing of an SSI stream. When a SSI directive is encountered, a new instance of this class is created and pushed on a stack.

To simplified the implementation, the entire file is read into a buffer. A previous version attempted to buffer less, but this ended up being a bit tricky due to the need to scan while reading and still maintain the block read() method.


Field Summary
static int AT_EOF
          Character returned to indicate EOF.
static int AT_SSI
          Character returned to indicate the beginning of an SSI directive.
 
Constructor Summary
SSIParsedStream(InputSource source, LineNumberRecorder lineNumbers)
          Constructor.
SSIParsedStream(InputSource source, LineNumberRecorder lineNumbers, SSIParsedStream prevStream)
          Constructor.
 
Method Summary
(package private) static void ()
          Class initializer
 String getSystemId()
          Get the system id of the associated file.
 SSIDirective parseSSIDirective()
          Parse the SSI directive that starts at the next available character in the buffer.
 SSIParsedStream pop()
          Close this input stream, returning the previous stream.
 int read()
          Read a character.
 int read(char[] cbuf, int off, int len)
          Read characters into a portion of an array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AT_EOF

public static final int AT_EOF
Character returned to indicate EOF.

AT_SSI

public static final int AT_SSI
Character returned to indicate the beginning of an SSI directive.
Constructor Detail

SSIParsedStream

public SSIParsedStream(InputSource source,
                       LineNumberRecorder lineNumbers)
                throws IOException
Constructor. Open the named file.

SSIParsedStream

public SSIParsedStream(InputSource source,
                       LineNumberRecorder lineNumbers,
                       SSIParsedStream prevStream)
                throws IOException
Constructor. Open the named file.
Method Detail

static void ()
Class initializer

getSystemId

public String getSystemId()
Get the system id of the associated file.

pop

public SSIParsedStream pop()
                    throws IOException
Close this input stream, returning the previous stream.

read

public int read()
         throws IOException
Read a character.
Returns:
The character, AT_EOF if no more characters are available, or AT_SSI if the next character in the buffer is an SSI directive.

read

public int read(char[] cbuf,
                int off,
                int len)
         throws IOException
Read characters into a portion of an array.
Returns:
The number of characters read, AT_EOF if no more characters are available, or AT_SSI if the next character in the buffer is an SSI directive.

parseSSIDirective

public SSIDirective parseSSIDirective()
                               throws IOException
Parse the SSI directive that starts at the next available character in the buffer.


Copyright © 1999-2002 enhydra.org (Mark Diekhans, David Li, Richard Kunze). All Rights reserved.