org.enhydra.xml.xmlc.misc
Class SSIParsedStream

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

final class SSIParsedStream
extends java.lang.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(org.xml.sax.InputSource source, LineNumberRecorder lineNumbers)
          Constructor.
SSIParsedStream(org.xml.sax.InputSource source, LineNumberRecorder lineNumbers, SSIParsedStream prevStream)
          Constructor.
 
Method Summary
 java.lang.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.

See Also:
Constant Field Values

AT_SSI

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

See Also:
Constant Field Values
Constructor Detail

SSIParsedStream

public SSIParsedStream(org.xml.sax.InputSource source,
                       LineNumberRecorder lineNumbers)
                throws java.io.IOException
Constructor. Open the named file.


SSIParsedStream

public SSIParsedStream(org.xml.sax.InputSource source,
                       LineNumberRecorder lineNumbers,
                       SSIParsedStream prevStream)
                throws java.io.IOException
Constructor. Open the named file.

Method Detail

getSystemId

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


pop

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

java.io.IOException

read

public int read()
         throws java.io.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.
java.io.IOException

read

public int read(char[] cbuf,
                int off,
                int len)
         throws java.io.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.
java.io.IOException

parseSSIDirective

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

java.io.IOException


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