org.apache.axiom.attachments
Class BoundaryPushbackInputStream
java.lang.Object
java.io.InputStream
org.apache.axiom.attachments.BoundaryPushbackInputStream
- All Implemented Interfaces:
- Closeable
public class BoundaryPushbackInputStream
- extends InputStream
An InputStream that reads bytes up to a boundary.
The boundary is not logically part of the bytes to read.
The wrapped PushbackInputStream is set to to the byte after
the boundary once the bytes are read.
The boundary is not logically returned.
There are two forms that are supported, where . is a byte
.......................boundary
and
..................../r/nboundary
In both cases, only the bytes (.) are returned.
Method Summary |
protected int |
boundaryPosition(byte[] searchbuf,
int start,
int end)
Read from the boundary delimited stream. |
boolean |
getBoundaryStatus()
|
int |
read()
Read from the boundary delimited stream. |
int |
read(byte[] b)
|
int |
read(byte[] b,
int off,
int len)
Read from the boundary delimited stream. |
String |
toString()
toString
dumps state information. |
BOUNDARY_NT_FOUND
protected static final int BOUNDARY_NT_FOUND
- See Also:
- Constant Field Values
BoundaryPushbackInputStream
public BoundaryPushbackInputStream(PushbackInputStream inStream,
byte[] boundary,
int pushBackSize)
- Parameters:
inStream
- boundary
- pushBackSize
-
read
public int read(byte[] b)
throws IOException
- Overrides:
read
in class InputStream
- Throws:
IOException
read
public int read()
throws IOException
- Read from the boundary delimited stream.
Generally, this won't be called...callers will
most likely call the read(byte[]..) methods
- Specified by:
read
in class InputStream
- Returns:
- The byte read, or -1 if endof stream.
- Throws:
IOException
read
public int read(byte[] b,
int off,
int len)
throws IOException
- Read from the boundary delimited stream.
- Overrides:
read
in class InputStream
- Parameters:
b
- is the array to read into.off
- is the offsetlen
-
- Returns:
- the number of bytes read. -1 if endof stream.
- Throws:
IOException
boundaryPosition
protected int boundaryPosition(byte[] searchbuf,
int start,
int end)
throws IOException
- Read from the boundary delimited stream.
- Parameters:
searchbuf
- start
- end
-
- Returns:
- The position of the boundary.
- Throws:
IOException
getBoundaryStatus
public boolean getBoundaryStatus()
toString
public String toString()
- toString
dumps state information. Effective for debug trace.
- Overrides:
toString
in class Object
Copyright © 2004-2011 The Apache Software Foundation. All Rights Reserved.