org.apache.abdera.i18n.text.io
Class PeekAheadInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by java.io.PushbackInputStream
              extended by org.apache.abdera.i18n.text.io.DynamicPushbackInputStream
                  extended by org.apache.abdera.i18n.text.io.RewindableInputStream
                      extended by org.apache.abdera.i18n.text.io.PeekAheadInputStream
All Implemented Interfaces:
Closeable

public class PeekAheadInputStream
extends RewindableInputStream

A version of RewindableInputStream that provides methods for peeking ahead in the stream (equivalent to read() followed by an appropriate unread()


Field Summary
 
Fields inherited from class java.io.PushbackInputStream
buf, pos
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
PeekAheadInputStream(InputStream in)
           
PeekAheadInputStream(InputStream in, int initialSize)
           
 
Method Summary
 int peek()
          Peek the next byte in the stream
 int peek(byte[] buf)
          Peek the next bytes in the stream.
 int peek(byte[] buf, int off, int len)
          Peek the next bytes in the stream.
 
Methods inherited from class org.apache.abdera.i18n.text.io.RewindableInputStream
position, read, read, rewind, rewind, rewind, skip
 
Methods inherited from class org.apache.abdera.i18n.text.io.DynamicPushbackInputStream
clear, shrink, unread, unread
 
Methods inherited from class java.io.PushbackInputStream
available, close, mark, markSupported, reset, unread
 
Methods inherited from class java.io.FilterInputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeekAheadInputStream

public PeekAheadInputStream(InputStream in)

PeekAheadInputStream

public PeekAheadInputStream(InputStream in,
                            int initialSize)
Method Detail

peek

public int peek()
         throws IOException
Peek the next byte in the stream

Throws:
IOException

peek

public int peek(byte[] buf)
         throws IOException
Peek the next bytes in the stream. Returns the number of bytes peeked. Will return -1 if the end of the stream is reached

Throws:
IOException

peek

public int peek(byte[] buf,
                int off,
                int len)
         throws IOException
Peek the next bytes in the stream. Returns the number of bytes peeked. Will return -1 if the end of the stream is reached

Throws:
IOException


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.