org.apache.xerces.impl

Class XMLEntityManager.RewindableInputStream

protected final class XMLEntityManager.RewindableInputStream extends InputStream

This class wraps the byte inputstreams we're presented with. We need it because java.io.InputStreams don't provide functionality to reread processed bytes, and they have a habit of reading more than one character when you call their read() methods. This means that, once we discover the true (declared) encoding of a document, we can neither backtrack to read the whole doc again nor start reading where we are with a new reader. This class allows rewinding an inputStream by allowing a mark to be set, and the stream reset to that position. The class assumes that it needs to read one character per invocation when it's read() method is inovked, but uses the underlying InputStream's read(char[], offset length) method--it won't buffer data read this way!

Author: Neil Graham, IBM Glenn Marcy, IBM

UNKNOWN:

Constructor Summary
RewindableInputStream(InputStream is)
Method Summary
intavailable()
voidclose()
voidmark(int howMuch)
booleanmarkSupported()
intread()
intread(byte[] b, int off, int len)
voidreset()
voidrewind()
voidsetStartOffset(int offset)
longskip(long n)

Constructor Detail

RewindableInputStream

public RewindableInputStream(InputStream is)

Method Detail

available

public int available()

close

public void close()

mark

public void mark(int howMuch)

markSupported

public boolean markSupported()

read

public int read()

read

public int read(byte[] b, int off, int len)

reset

public void reset()

rewind

public void rewind()

setStartOffset

public void setStartOffset(int offset)

skip

public long skip(long n)
Copyright © 1999-2005 Apache XML Project. All Rights Reserved.