Package org.apache.axis.attachments
Class DimeDelimitedInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.axis.attachments.DimeDelimitedInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
This class takes the input stream and turns it multiple streams.
DIME version 0 format
0 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
FieldsModifier and TypeFieldDescriptionprotected static org.apache.commons.logging.Log
protected static int
protected IOException
protected int
Fields inherited from class java.io.FilterInputStream
in
-
Method Summary
Modifier and TypeMethodDescriptionprotected int
_read
(byte[] b, int off, int len) int
void
close()
Closes the stream.protected void
Get the id for this stream part.getType()
Get the type, as read from the header.void
mark
(int readlimit) Mark the stream.boolean
protected static int
int
read()
Read from the boundary delimited stream.int
read
(byte[] b) Read from the delimited stream.int
read
(byte[] b, int off, int len) Read from the DIME stream.void
reset()
Methods inherited from class java.io.FilterInputStream
skip
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
log
protected static org.apache.commons.logging.Log log -
streamNo
protected int streamNo -
streamInError
-
streamCount
protected static int streamCount
-
-
Method Details
-
newStreamNo
protected static int newStreamNo() -
getContentId
Get the id for this stream part.- Returns:
- the id;
-
getDimeTypeNameFormat
-
getType
Get the type, as read from the header.- Returns:
- the type of this dime
-
read
Read from the DIME stream.- Overrides:
read
in classFilterInputStream
- Parameters:
b
- is the array to read into.off
- is the offset- Returns:
- the number of bytes read. -1 if endof stream
- Throws:
IOException
- if data could not be read from the stream
-
_read
- Throws:
IOException
-
read
Read from the delimited stream.- Overrides:
read
in classFilterInputStream
- 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:
IOException
- if data could not be read from the stream
-
read
Read from the boundary delimited stream.- Overrides:
read
in classFilterInputStream
- Returns:
- the byte read, or -1 if endof stream
- Throws:
IOException
- if there was an error reading the data
-
close
Closes 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterInputStream
- Throws:
IOException
- if the stream could not be closed
-
mark
public void mark(int readlimit) Mark the stream. This is not supported.- Overrides:
mark
in classFilterInputStream
-
reset
- Overrides:
reset
in classFilterInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classFilterInputStream
-
available
- Overrides:
available
in classFilterInputStream
- Throws:
IOException
-
finalClose
- Throws:
IOException
-