Package org.apache.axis.attachments
Class DimeDelimitedInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.apache.axis.attachments.DimeDelimitedInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class DimeDelimitedInputStream extends java.io.FilterInputStreamThis class takes the input stream and turns it multiple streams. DIME version 0 format0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ --- | VERSION |B|E|C| TYPE_T| OPT_T | OPTIONS_LENGTH | A +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ID_LENGTH | TYPE_LENGTH | Always present 12 bytes +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ even on chunked data. | DATA_LENGTH | V +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ --- | / / OPTIONS + PADDING / / (absent for version 0) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | / / ID + PADDING / / | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | / / TYPE + PADDING / / | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | / / DATA + PADDING / / | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
This implementation of input stream does not support marking operations.- Author:
- Rick Rineholt
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.apache.commons.logging.Loglogprotected static intstreamCountprotected java.io.IOExceptionstreamInErrorprotected intstreamNo
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int_read(byte[] b, int off, int len)intavailable()voidclose()Closes the stream.protected voidfinalClose()java.lang.StringgetContentId()Get the id for this stream part.DimeTypeNameFormatgetDimeTypeNameFormat()java.lang.StringgetType()Get the type, as read from the header.voidmark(int readlimit)Mark the stream.booleanmarkSupported()protected static intnewStreamNo()intread()Read from the boundary delimited stream.intread(byte[] b)Read from the delimited stream.intread(byte[] b, int off, int len)Read from the DIME stream.voidreset()
-
-
-
Method Detail
-
newStreamNo
protected static int newStreamNo()
-
getContentId
public java.lang.String getContentId()
Get the id for this stream part.- Returns:
- the id;
-
getDimeTypeNameFormat
public DimeTypeNameFormat getDimeTypeNameFormat()
-
getType
public java.lang.String getType()
Get the type, as read from the header.- Returns:
- the type of this dime
-
read
public int read(byte[] b, int off, int len) throws java.io.IOExceptionRead from the DIME stream.- Overrides:
readin classjava.io.FilterInputStream- Parameters:
b- is the array to read into.off- is the offset- Returns:
- the number of bytes read. -1 if endof stream
- Throws:
java.io.IOException- if data could not be read from the stream
-
_read
protected int _read(byte[] b, int off, int len) throws java.io.IOException- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOExceptionRead from the delimited stream.- Overrides:
readin classjava.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- if data could not be read from the stream
-
read
public int read() throws java.io.IOExceptionRead from the boundary delimited stream.- Overrides:
readin classjava.io.FilterInputStream- Returns:
- the byte read, or -1 if endof stream
- Throws:
java.io.IOException- if there was an error reading the data
-
close
public void close() throws java.io.IOExceptionCloses the stream.This will take care of flushing any remaining data to the strea.
Multiple calls to this method will result in the stream being closed once and then all subsequent calls being ignored.
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.FilterInputStream- Throws:
java.io.IOException- if the stream could not be closed
-
mark
public void mark(int readlimit)
Mark the stream. This is not supported.- Overrides:
markin classjava.io.FilterInputStream
-
reset
public void reset() throws java.io.IOException- Overrides:
resetin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classjava.io.FilterInputStream
-
available
public int available() throws java.io.IOException- Overrides:
availablein classjava.io.FilterInputStream- Throws:
java.io.IOException
-
finalClose
protected void finalClose() throws java.io.IOException- Throws:
java.io.IOException
-
-