APIdia Launch Partner
Top Description Fields Constructors Methods
sun.net.www.http

public Class KeepAliveStream

extends MeteredStream
implements Hurryable
Class Inheritance
All Implemented Interfaces
sun.net.www.http.Hurryable
Imports
java.io.*, sun.net.www.MeteredStream, jdk.internal.misc.InnocuousThread

A stream that has the property of being able to be kept alive for multiple downloads from the same server.
Authors
Stephen R. Pietrowicz (NCSA), Dave Brown

Field Summary

Modifier and TypeField and Description
private static Thread
pack-priv HttpClient
pack-priv boolean
private static final KeepAliveStreamCleaner
protected volatile boolean
Inherited from sun.net.www.MeteredStream:
closedcountexpectedmarkedCountmarkLimit

Constructor Summary

AccessConstructor and Description
public
KeepAliveStream(InputStream is, long expected, HttpClient hc)

Constructor

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides sun.net.www.MeteredStream.close.

Implements java.io.Closeable.close.

Attempt to cache this connection

public boolean
public void
mark(int limit)

Overrides sun.net.www.MeteredStream.mark.

Marks the current position in this input stream.

public boolean
markSupported()

Overrides sun.net.www.MeteredStream.markSupported.

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

private static void
protected long
public void
reset()

Overrides sun.net.www.MeteredStream.reset.

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

protected void
Inherited from sun.net.www.MeteredStream:
availableisLockHeldByCurrentThreadlockreadreadskipunlock

Field Detail

cleanerThreadback to summary
private static Thread cleanerThread
hcback to summary
pack-priv HttpClient hc
hurriedback to summary
pack-priv boolean hurried
queueback to summary
private static final KeepAliveStreamCleaner queue
queuedForCleanupback to summary
protected volatile boolean queuedForCleanup

Constructor Detail

KeepAliveStreamback to summary
public KeepAliveStream(InputStream is, long expected, HttpClient hc)

Constructor

Method Detail

closeback to summary
public void close() throws IOException

Overrides sun.net.www.MeteredStream.close.

Implements java.io.Closeable.close.

Attempt to cache this connection

Exceptions
IOException:

Doc from java.io.FilterInputStream.close.

if an I/O error occurs.

hurryback to summary
public boolean hurry()

Implements sun.net.www.http.Hurryable.hurry.

markback to summary
public void mark(int limit)

Overrides sun.net.www.MeteredStream.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 sun.net.www.MeteredStream.markSupported.

Doc from java.io.FilterInputStream.markSupported.

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

queueForCleanupback to summary
private static void queueForCleanup(KeepAliveCleanerEntry kace)
remainingToReadback to summary
protected long remainingToRead()
resetback to summary
public void reset() throws IOException

Overrides sun.net.www.MeteredStream.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.
setClosedback to summary
protected void setClosed()