Top Fields Constructors Methods
sun.net.httpserver

pack-priv Class ChunkedInputStream

extends LeftOverInputStream
Class Inheritance
Imports
java.io.*, java.net.*, com.sun.net.httpserver.*, com.sun.net.httpserver.spi.*

Field Summary

Modifier and TypeField and Description
pack-priv static final char
pack-priv static final char
private static final int
private boolean
private int
Inherited from sun.net.httpserver.LeftOverInputStream:
closedeofoneservert

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public int
available()

Overrides java.io.FilterInputStream.available.

returns the number of bytes available to read in the current chunk which may be less than the real amount, but we'll live with that limitation for the moment.
private void
public boolean
isDataBuffered()

Overrides sun.net.httpserver.LeftOverInputStream.isDataBuffered.

if bytes are left over buffered on *the UNDERLYING* stream
public void
mark(int
the maximum limit of bytes that can be read before the mark position becomes invalid.
l
)

Overrides java.io.FilterInputStream.mark.

Marks the current position in this input stream.
public boolean
markSupported()

Overrides java.io.FilterInputStream.markSupported.

Tests if this input stream supports the mark and reset methods.
private int
numeric(char[] arr, int nchars)

private int
protected int
readImpl(byte[] b, int off, int len)

Implements abstract sun.net.httpserver.LeftOverInputStream.readImpl.

public void
reset()

Overrides java.io.FilterInputStream.reset.

Repositions this stream to the position at the time the mark method was last called on this input stream.
Inherited from sun.net.httpserver.LeftOverInputStream:
closedrainisClosedisEOFreadreadskip

Field Detail

CRback to summary
pack-priv static final char CR
LFback to summary
pack-priv static final char LF
MAX_CHUNK_HEADER_SIZEback to summary
private static final int MAX_CHUNK_HEADER_SIZE
needToReadHeaderback to summary
private boolean needToReadHeader
remainingback to summary
private int remaining

Constructor Detail

ChunkedInputStreamback to summary
pack-priv ChunkedInputStream(ExchangeImpl t, InputStream src)

Method Detail

availableback to summary
public int available() throws IOException

Overrides java.io.FilterInputStream.available.

returns the number of bytes available to read in the current chunk which may be less than the real amount, but we'll live with that limitation for the moment. It only affects potential efficiency rather than correctness.

Returns:int

Doc from java.io.FilterInputStream.available.

an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking.

Exceptions
IOException:

Doc from java.io.FilterInputStream.available.

if an I/O error occurs.

consumeCRLFback to summary
private void consumeCRLF() throws IOException
isDataBufferedback to summary
public boolean isDataBuffered() throws IOException

Overrides sun.net.httpserver.LeftOverInputStream.isDataBuffered.

Doc from sun.net.httpserver.LeftOverInputStream.isDataBuffered.

if bytes are left over buffered on *the UNDERLYING* stream

markback to summary
public void mark(int l)

Overrides java.io.FilterInputStream.mark.

Doc from java.io.FilterInputStream.mark.

Marks the current position in this input stream. A subsequent call to the reset method repositions this stream at the last marked position so that subsequent reads re-read the same bytes.

The readlimit argument tells this input stream to allow that many bytes to be read before the mark position gets invalidated.

Parameters
l:int

the maximum limit of bytes that can be read before the mark position becomes invalid.

markSupportedback to summary
public boolean markSupported()

Overrides java.io.FilterInputStream.markSupported.

Doc from java.io.FilterInputStream.markSupported.

Tests if this input stream supports the mark and reset methods.

Returns:boolean

true if this stream type supports the mark and reset method; false otherwise.

numericback to summary
private int numeric(char[] arr, int nchars) throws IOException
readChunkHeaderback to summary
private int readChunkHeader() throws IOException
readImplback to summary
protected int readImpl(byte[] b, int off, int len) throws IOException

Implements abstract sun.net.httpserver.LeftOverInputStream.readImpl.

resetback to summary
public void reset() throws IOException

Overrides java.io.FilterInputStream.reset.

Doc from java.io.FilterInputStream.reset.

Repositions this stream to the position at the time the mark method was last called on this input stream.

Stream marks are intended to be used in situations where you need to read ahead a little to see what's in the stream. Often this is most easily done by invoking some general parser. If the stream is of the type handled by the parse, it just chugs along happily. If the stream is not of that type, the parser should toss an exception when it fails. If this happens within readlimit bytes, it allows the outer code to reset the stream and try another parser.

Exceptions
IOException:
if this stream has not been marked or if the mark has been invalidated.