Top Description Fields Constructors Methods
org.postgresql.util

public final Class StreamWrapper

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Static Imports
org.postgresql.util.internal.Nullness.castNonNull

Wrapper around a length-limited InputStream.
Author
Oliver Jowett ([email protected])

Field Summary

Modifier and TypeField and Description
private @Nullable LazyCleaner.Cleanable<IOException>
private final Object
private final int
private static final int
private final int
private final @Nullable byte[]
private final @Nullable InputStream
private static final String
private @Nullable TempFileHolder

Constructor Summary

AccessConstructor and Description
public
StreamWrapper(byte[] data, int offset, int length)

public
StreamWrapper(InputStream stream, int length)

public

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

private static int
copyStream(InputStream inputStream, OutputStream outputStream, int limit)

public @Nullable byte[]
public int
public int
public InputStream
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

cleanerback to summary
private @Nullable LazyCleaner.Cleanable<IOException> cleaner
leakHandleback to summary
private final Object leakHandle
lengthback to summary
private final int length
MAX_MEMORY_BUFFER_BYTESback to summary
private static final int MAX_MEMORY_BUFFER_BYTES
offsetback to summary
private final int offset
rawDataback to summary
private final @Nullable byte[] rawData
streamback to summary
private final @Nullable InputStream stream
TEMP_FILE_PREFIXback to summary
private static final String TEMP_FILE_PREFIX
tempFileHolderback to summary
private @Nullable TempFileHolder tempFileHolder

Constructor Detail

StreamWrapperback to summary
public StreamWrapper(byte[] data, int offset, int length)
StreamWrapperback to summary
public StreamWrapper(InputStream stream, int length)
StreamWrapperback to summary
public StreamWrapper(InputStream stream) throws PSQLException

Method Detail

closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
copyStreamback to summary
private static int copyStream(InputStream inputStream, OutputStream outputStream, int limit) throws IOException
getBytesback to summary
public @Nullable byte[] getBytes()
getLengthback to summary
public int getLength()
getOffsetback to summary
public int getOffset()
getStreamback to summary
public InputStream getStream() throws IOException
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override