org.codehaus.swizzle.stream
Class TruncateInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.codehaus.swizzle.stream.PushbackInputStream
          extended by org.codehaus.swizzle.stream.TruncateInputStream
All Implemented Interfaces:
java.io.Closeable, PushbackBuffer

public class TruncateInputStream
extends PushbackInputStream

Reads from the underlying stream up until the token passed in. After the token passed in is read, only -1 will be returned without affecting the underlying stream.

Version:
$Revision$ $Date$

Constructor Summary
TruncateInputStream(java.io.InputStream in, java.lang.String end)
           
TruncateInputStream(java.io.InputStream delegate, java.lang.String end, boolean caseSensitive)
           
 
Method Summary
 byte[] getBuffer()
          Gets the current contents of the buffer
 java.lang.String getEndToken()
           
protected  int getNextByte()
           
 
Methods inherited from class org.codehaus.swizzle.stream.PushbackInputStream
addToMarkBuffer, getDelegate, mark, markSupported, read, reset, unmark, unread, unread
 
Methods inherited from class java.io.InputStream
available, close, read, read, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TruncateInputStream

public TruncateInputStream(java.io.InputStream in,
                           java.lang.String end)

TruncateInputStream

public TruncateInputStream(java.io.InputStream delegate,
                           java.lang.String end,
                           boolean caseSensitive)
Method Detail

getEndToken

public java.lang.String getEndToken()

getNextByte

protected int getNextByte()
                   throws java.io.IOException
Overrides:
getNextByte in class PushbackInputStream
Throws:
java.io.IOException

getBuffer

public byte[] getBuffer()
Gets the current contents of the buffer

Specified by:
getBuffer in interface PushbackBuffer
Overrides:
getBuffer in class PushbackInputStream


Copyright © 2011 The Codehaus Foundation. All Rights Reserved.