Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.axis.attachments
Class DimeDelimitedInputStream  view DimeDelimitedInputStream download DimeDelimitedInputStream.java

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended byorg.apache.axis.attachments.DimeDelimitedInputStream
All Implemented Interfaces:
java.io.Closeable

public class DimeDelimitedInputStream
extends java.io.FilterInputStream

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.


Field Summary
(package private)  long bytesRead
           
(package private)  boolean closed
           
(package private)  int dataPadLength
           
(package private)  java.lang.String id
           
(package private)  java.io.InputStream is
           
(package private) static boolean isDebugEnabled
           
protected static org.apache.commons.logging.Log log
           
(package private)  boolean MB
           
(package private)  boolean ME
           
(package private)  boolean moreChunks
           
(package private)  long recordLength
           
protected static int streamCount
           
protected  java.io.IOException streamInError
           
protected  int streamNo
           
(package private)  boolean theEnd
           
(package private)  DimeTypeNameFormat tnf
           
private static byte[] trash
           
(package private)  java.lang.String type
           
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
(package private) DimeDelimitedInputStream(java.io.InputStream is)
          Create a new dime stream.
 
Method Summary
protected  int _read(byte[] b, int off, int len)
           
 int available()
          Calls the in.available() method.
 void close()
          Closes the stream.
protected  void finalClose()
           
 java.lang.String getContentId()
          Get the id for this stream part.
 DimeTypeNameFormat getDimeTypeNameFormat()
           
(package private)  DimeDelimitedInputStream getNextStream()
          Gets the next stream.
 java.lang.String getType()
          Get the type, as read from the header.
 void mark(int readlimit)
          Mark the stream.
 boolean markSupported()
          Calls the in.markSupported() method.
protected static int newStreamNo()
           
 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.
private  int readFromStream(byte[] b)
           
private  int readFromStream(byte[] b, int start, int length)
           
(package private)  void readHeader(boolean isChunk)
           
private  int readPad(int size)
           
 void reset()
          Calls the in.reset() method.
 
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

is

java.io.InputStream is

closed

volatile boolean closed

theEnd

boolean theEnd

moreChunks

boolean moreChunks

MB

boolean MB

ME

boolean ME

tnf

DimeTypeNameFormat tnf

type

java.lang.String type

id

java.lang.String id

recordLength

long recordLength

bytesRead

long bytesRead

dataPadLength

int dataPadLength

trash

private static byte[] trash

streamNo

protected int streamNo

streamInError

protected java.io.IOException streamInError

streamCount

protected static int streamCount

isDebugEnabled

static boolean isDebugEnabled
Constructor Detail

DimeDelimitedInputStream

DimeDelimitedInputStream(java.io.InputStream is)
                   throws java.io.IOException
Create a new dime stream.

Method Detail

newStreamNo

protected static int newStreamNo()

getNextStream

DimeDelimitedInputStream getNextStream()
                                 throws java.io.IOException
Gets the next stream. From the previous using new buffer reading size.


readPad

private final int readPad(int size)
                   throws java.io.IOException

readFromStream

private final int readFromStream(byte[] b)
                          throws java.io.IOException

readFromStream

private final int readFromStream(byte[] b,
                                 int start,
                                 int length)
                          throws java.io.IOException

getContentId

public java.lang.String getContentId()
Get the id for this stream part.


getDimeTypeNameFormat

public DimeTypeNameFormat getDimeTypeNameFormat()

getType

public java.lang.String getType()
Get the type, as read from the header.


read

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


_read

protected int _read(byte[] b,
                    int off,
                    int len)
             throws java.io.IOException

readHeader

void readHeader(boolean isChunk)
          throws java.io.IOException

read

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


read

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


close

public void close()
           throws java.io.IOException
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.


mark

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


reset

public void reset()
           throws java.io.IOException
Description copied from class: java.io.FilterInputStream
Calls the in.reset() method.


markSupported

public boolean markSupported()
Description copied from class: java.io.FilterInputStream
Calls the in.markSupported() method.


available

public int available()
              throws java.io.IOException
Description copied from class: java.io.FilterInputStream
Calls the in.available() method.


finalClose

protected void finalClose()
                   throws java.io.IOException