org.apache.axis.attachments
Class BoundaryDelimitedStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--java.io.FilterInputStream
              |
              +--org.apache.axis.attachments.BoundaryDelimitedStream

public class BoundaryDelimitedStream
extends java.io.FilterInputStream

This class takes the input stream and turns it multiple streams.

Author:
Rick Rineholt

Field Summary
protected  byte[] boundary
          Field boundary
protected static int BOUNDARY_NOT_FOUND
          Field BOUNDARY_NOT_FOUND
protected static org.apache.commons.logging.Log log
          Field log
protected  int streamNo
          Field streamNo
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
protected BoundaryDelimitedStream(BoundaryDelimitedStream prev, int readbufsz)
          Constructor to create the next stream from the previous one.
 
Method Summary
 int available()
          Method available
protected  int boundaryPosition(byte[] searchbuf, int start, int end)
          Read from the boundary delimited stream.
 void close()
          Closes the stream.
protected  void finalClose()
           
 BoundaryDelimitedStream getNextStream()
          Gets the next stream.
protected  BoundaryDelimitedStream getNextStream(int readbufsz)
          Gets the next stream.
 void mark(int readlimit)
          mark the stream.
 boolean markSupported()
          markSupported return false;
protected static int newStreamNo()
          Method newStreamNo
static void printarry(byte[] b, int start, int end)
          Method printarry
 int read()
          Read from the boundary delimited stream.
 int read(byte[] b)
          Read from the boundary delimited stream.
 int read(byte[] b, int off, int len)
          Read from the boundary delimited stream.
 void reset()
          reset the stream.
 
Methods inherited from class java.io.FilterInputStream
skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
Field log


boundary

protected byte[] boundary
Field boundary


BOUNDARY_NOT_FOUND

protected static final int BOUNDARY_NOT_FOUND
Field BOUNDARY_NOT_FOUND

See Also:
Constant Field Values

streamNo

protected int streamNo
Field streamNo

Constructor Detail

BoundaryDelimitedStream

protected BoundaryDelimitedStream(BoundaryDelimitedStream prev,
                                  int readbufsz)
                           throws java.io.IOException
Constructor to create the next stream from the previous one.

Parameters:
prev -
readbufsz -
Method Detail

newStreamNo

protected static int newStreamNo()
Method newStreamNo

Returns:

getNextStream

public BoundaryDelimitedStream getNextStream()
                                      throws java.io.IOException
Gets the next stream. From the previous using the same buffer size to read.

Returns:
the boundary delmited stream. Null if there are no more streams.
java.io.IOException

getNextStream

protected BoundaryDelimitedStream getNextStream(int readbufsz)
                                         throws java.io.IOException
Gets the next stream. From the previous using new buffer reading size.

Parameters:
readbufsz -
Returns:
the boundary delmited stream. Null if there are no more streams.
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Read from the boundary delimited stream.

Overrides:
read in class java.io.FilterInputStream
Parameters:
b - is the array to read into.
off - is the offset
len -
Returns:
the number of bytes read. -1 if endof stream.
Throws:
java.io.IOException

read

public int read(byte[] b)
         throws java.io.IOException
Read from the boundary delimited stream.

Overrides:
read in class java.io.FilterInputStream
Parameters:
b - is the array to read into. Read as much as possible into the size of this array.
Returns:
the number of bytes read. -1 if endof stream.
Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Read from the boundary delimited stream.

Overrides:
read in class java.io.FilterInputStream
Returns:
The byte read, or -1 if endof stream.
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Closes the stream.

Overrides:
close in class java.io.FilterInputStream
Throws:
java.io.IOException

mark

public void mark(int readlimit)
mark the stream. This is not supported.

Overrides:
mark in class java.io.FilterInputStream
Parameters:
readlimit -

reset

public void reset()
           throws java.io.IOException
reset the stream. This is not supported.

Overrides:
reset in class java.io.FilterInputStream
Throws:
java.io.IOException

markSupported

public boolean markSupported()
markSupported return false;

Overrides:
markSupported in class java.io.FilterInputStream
Returns:

available

public int available()
              throws java.io.IOException
Method available

Overrides:
available in class java.io.FilterInputStream
Returns:
Throws:
java.io.IOException

boundaryPosition

protected int boundaryPosition(byte[] searchbuf,
                               int start,
                               int end)
                        throws java.io.IOException
Read from the boundary delimited stream.

Parameters:
searchbuf -
start -
end -
Returns:
The position of the boundary. Detects the end of the source stream.
java.io.IOException

finalClose

protected void finalClose()
                   throws java.io.IOException
java.io.IOException

printarry

public static void printarry(byte[] b,
                             int start,
                             int end)
Method printarry

Parameters:
b -
start -
end -


Copyright © 2003 Apache Web Services Project. All Rights Reserved.