APIdia Launch Partner
Top Description Fields Constructors Methods
sun.net.httpserver

pack-priv Class FixedLengthInputStream

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

a class which allows the caller to read up to a defined number of bytes off an underlying stream close() does not close the underlying stream

Field Summary

Modifier and TypeField and Description
private long
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 an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.

public void
mark(int 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.

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:
closedrainisClosedisDataBufferedisEOFreadreadskip

Field Detail

remainingback to summary
private long remaining

Constructor Detail

FixedLengthInputStreamback to summary
pack-priv FixedLengthInputStream(ExchangeImpl t, InputStream src, long len)

Method Detail

availableback to summary
public int available() throws IOException

Overrides java.io.FilterInputStream.available.

Doc from java.io.FilterInputStream.available.

Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. The next caller might be the same thread or another thread. A single read or skip of this many bytes will not block, but may read or skip fewer bytes.

Exceptions
IOException:
if an I/O error occurs.
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.

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.

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.