com.caucho.server.http
Class ContentLengthStream
java.lang.Object
com.caucho.vfs.StreamImpl
com.caucho.server.http.ContentLengthStream
public class ContentLengthStream
- extends StreamImpl
Filter so POST readers can only read data up to the content length
Method Summary |
boolean |
canRead()
Returns true if this is a read stream. |
int |
getAvailable()
Returns the number of bytes available without blocking. |
int |
read(byte[] buffer,
int offset,
int length)
Reads from the buffer, limiting to the content length. |
java.lang.String |
toString()
|
Methods inherited from class com.caucho.vfs.StreamImpl |
canWrite, clearWrite, close, closeWrite, flush, flushBuffer, flushToDisk, getAttribute, getAttributeNames, getFlushOnNewline, getNewline, getPath, getReadBuffer, getReadPosition, hasSkip, isClosed, isEof, isMmapEnabled, isSendfileEnabled, readNonBlock, readTimeout, removeAttribute, seekEnd, seekStart, setAttribute, setPath, setWriteEncoding, skip, write, write, writeMmap, writeSendfile |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ContentLengthStream
public ContentLengthStream()
canRead
public boolean canRead()
- Description copied from class:
StreamImpl
- Returns true if this is a read stream.
- Overrides:
canRead
in class StreamImpl
read
public int read(byte[] buffer,
int offset,
int length)
throws java.io.IOException
- Reads from the buffer, limiting to the content length.
- Overrides:
read
in class StreamImpl
- Parameters:
buffer
- the buffer containing the results.offset
- the offset into the result bufferlength
- the length of the buffer.
- Returns:
- the number of bytes read or -1 for the end of the file.
- Throws:
java.io.IOException
getAvailable
public int getAvailable()
throws java.io.IOException
- Description copied from class:
StreamImpl
- Returns the number of bytes available without blocking. Depending on
the stream, this may return less than the actual bytes, but will always
return a number > 0 if there is any data available.
- Overrides:
getAvailable
in class StreamImpl
- Throws:
java.io.IOException
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object