APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.security.provider

pack-priv Class FileInputStreamPool

extends Object
Class Inheritance
Imports
java.io.*, java.lang.ref.ReferenceQueue, .WeakReference, java.util.concurrent.ConcurrentHashMap, .ConcurrentMap

A pool of InputStreams opened from distinct files. Only a single instance is ever opened from the same file. This is used to read special infinite files like /dev/random where the current file pointer is not relevant, so multiple readers can share the same file descriptor and consequently the same InputStream.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final ConcurrentMap<File, FileInputStreamPool.StreamRef>
pool

a pool of: StreamRef -> UnclosableInputStream -> FileInputStream(s)

private static final ReferenceQueue<FileInputStreamPool.UnclosableInputStream>
refQueue

a reference queue of cleared StreamRef(s)

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static InputStream

Returns:

a shared java.io.InputStream instance opened from given file.
getInputStream
(File
the file to be opened for reading.
file
)

This method opens an underlying java.io.FileInputStream for a given file and returns a wrapper over it.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

poolback to summary
private static final ConcurrentMap<File, FileInputStreamPool.StreamRef> pool

a pool of: StreamRef -> UnclosableInputStream -> FileInputStream(s)

refQueueback to summary
private static final ReferenceQueue<FileInputStreamPool.UnclosableInputStream> refQueue

a reference queue of cleared StreamRef(s)

Constructor Detail

FileInputStreamPoolback to summary
pack-priv FileInputStreamPool()

Method Detail

getInputStreamback to summary
pack-priv static InputStream getInputStream(File file) throws IOException

This method opens an underlying java.io.FileInputStream for a given file and returns a wrapper over it. The wrapper is shared among multiple readers of the same file and ignores java.io.InputStream#close() requests. The underlying stream is closed when all references to the wrapper are relinquished.

Parameters
file:File

the file to be opened for reading.

Returns:InputStream

a shared java.io.InputStream instance opened from given file.

Exceptions
FileNotFoundException:
if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.
sun.security.provider back to summary

private Class FileInputStreamPool.StreamRef

extends WeakReference<FileInputStreamPool.UnclosableInputStream>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final File

Constructor Summary

AccessConstructor and Description
pack-priv

Field Detail

fileback to summary
pack-priv final File file

Constructor Detail

StreamRefback to summary
pack-priv StreamRef(File file, FileInputStreamPool.UnclosableInputStream stream, ReferenceQueue<FileInputStreamPool.UnclosableInputStream> refQueue)
sun.security.provider back to summary

private final Class FileInputStreamPool.UnclosableInputStream

extends FilterInputStream
Class Inheritance

Field Summary

Inherited from java.io.FilterInputStream:
in

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides java.io.FilterInputStream.close.

Implements java.io.Closeable.close.

Closes this input stream and releases any system resources associated with the stream.

pack-priv InputStream
Inherited from java.io.FilterInputStream:
availablemarkmarkSupportedreadreadreadresetskip

Constructor Detail

UnclosableInputStreamback to summary
pack-priv UnclosableInputStream(InputStream in)

Method Detail

closeback to summary
public void close() throws IOException

Overrides java.io.FilterInputStream.close.

Implements java.io.Closeable.close.

Doc from java.io.FilterInputStream.close.

Closes this input stream and releases any system resources associated with the stream.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
getWrappedStreamback to summary
pack-priv InputStream getWrappedStream()