com.bbn.swede.core.dom
Class UnparseableFilterStream

java.lang.Object
  extended byjava.io.InputStream
      extended bycom.bbn.swede.core.dom.UnparseableFilterStream

public class UnparseableFilterStream
extends InputStream

A wrapper for a java.io.InputStream that blanks out portions of the stream. It behaves like a regular stream with the exception that, given a list of text regions to ignore, all text in the specified regions is replaced with spaces. This allows stream-based parsers to easily work around portions of the text that are known to be invalid.


Field Summary
protected  List _lInvalidRegions
          A list of IRegions to blank out when reading from _stream.
protected  long _lPos
          The current position within the stream.
protected  InputStream _stream
          The inner input stream.
 
Constructor Summary
UnparseableFilterStream(InputStream stream, IRegion[] regions)
          Creates a new UnparseableFilterStream based on a specified stream and set of blank-out regions.
 
Method Summary
 int available()
           
 void close()
           
protected  IRegion findContainingRegion(long offset)
          Checks the list of blank-out regions for one containing a specific offset .
 void mark(int arg0)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void reset()
           
 long skip(long arg0)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_stream

protected InputStream _stream
The inner input stream.


_lInvalidRegions

protected List _lInvalidRegions
A list of IRegions to blank out when reading from _stream.


_lPos

protected long _lPos
The current position within the stream.

Constructor Detail

UnparseableFilterStream

public UnparseableFilterStream(InputStream stream,
                               IRegion[] regions)
Creates a new UnparseableFilterStream based on a specified stream and set of blank-out regions.

Parameters:
stream - The stream to wrap
regions - The regions to blank out in the wrapped stream
Method Detail

findContainingRegion

protected IRegion findContainingRegion(long offset)
Checks the list of blank-out regions for one containing a specific offset .

Parameters:
offset - The offset to locate
Returns:
The blank-out region containing the offset, or null if it does not fall in a blank-out region

read

public int read()
         throws IOException
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Throws:
IOException

read

public int read(byte[] b)
         throws IOException
Throws:
IOException

available

public int available()
              throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Throws:
IOException

mark

public void mark(int arg0)

markSupported

public boolean markSupported()

reset

public void reset()
           throws IOException
Throws:
IOException

skip

public long skip(long arg0)
          throws IOException
Throws:
IOException


Copyright © 2004-2005 BBN Technologies. All Rights Reserved.