MultipartValueStream (Apache Struts API Documentation)
Keywords: org.apache.struts.upload.MultipartValueStream,MultipartValueStream class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.struts.upload
Class MultipartValueStream

    java.lang.Object
      |
      +--java.io.InputStream
            |
            +--org.apache.struts.upload.MultipartValueStream

class MultipartValueStream
extends java.io.InputStream

This class implements an inputStream that reads another stream until a multipart boundary is found. The class reports eof when boundary found. The undelying stream is not closed.

See RFC 1867 (http://info.internet.isi.edu:80/in-notes/rfc/files/rfc1867.txt) for details about the protocol.

Author:
  Jimmy Larsson

Field Summary
`private byte[]` | `boundaryBytes` byte buffer with the boundary
`private boolean` | `boundaryReached` have we reached the boundary?
`private boolean` | `finalBoundaryReached` is the boundary found a final boundary?
`static java.lang.String` | `HEADER_ENCODING`
`private java.io.InputStream` | `in` the underlying stream
`private int` | `matchedBoundaryBytes` how many curretly matched boundary bytes?
`private int` | `readAheadBufferEndI` The end index for the read ahead cyclic buffer (points to the last byte)
`private int` | `readAheadBufferStartI` The start index for the read ahead cyclic buffer (points to the first byte)
`private byte[]` | `readAheadBytes` the read ahead buffer (cyclic)

Fields inherited from class java.io.InputStream
``

Constructor Summary
`MultipartValueStream(java.io.InputStream in, java.lang.String boundary)` Create a stream that stops reading at the boundary NOTE: the boundary parameter is without the trailing dashes "--".

Method Summary
`boolean` | `encounteredFinalBoundary()`
`int` | `read()` Read the next byte

Methods inherited from class java.io.InputStream
`available, close, mark, markSupported, read, read, reset, skip`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### HEADER_ENCODING

    public static final java.lang.String HEADER_ENCODING

See Also:
  Constant Field Values

### in

    private java.io.InputStream in

  the underlying stream

### boundaryBytes

    private byte[] boundaryBytes

  byte buffer with the boundary

### matchedBoundaryBytes

    private int matchedBoundaryBytes

  how many curretly matched boundary bytes?

### readAheadBytes

    private byte[] readAheadBytes

  the read ahead buffer (cyclic)

### readAheadBufferStartI

    private int readAheadBufferStartI

  The start index for the read ahead cyclic buffer (points to the first byte)

### readAheadBufferEndI

    private int readAheadBufferEndI

  The end index for the read ahead cyclic buffer (points to the last byte)

### boundaryReached

    private boolean boundaryReached

  have we reached the boundary?

### finalBoundaryReached

    private boolean finalBoundaryReached

  is the boundary found a final boundary?

Constructor Detail

### MultipartValueStream

    public MultipartValueStream(java.io.InputStream in,
                                java.lang.String boundary)
                         throws java.io.IOException

  Create a stream that stops reading at the boundary NOTE: the boundary parameter is without the trailing dashes "--".

Method Detail

### read

    public int read()
             throws java.io.IOException

  Read the next byte

  Specified by:
    `read` in class `java.io.InputStream`
  Returns:
    -1 on boundary reached
  Throws:
    `java.io.IOException` - if the ending boundary is never found

### encounteredFinalBoundary

    public boolean encounteredFinalBoundary()
                                     throws javax.servlet.ServletException

  Returns:
    true if we are the last stream, ie. we encountered a final boundary
  Throws:
    `javax.servlet.ServletException` - if the boundary has not yet been reached

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2002 - Apache Software Foundation