Class AutoCloseableContentLengthVerifyingInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.oracle.bmc.http.client.jersey3.io.internal.ContentLengthVerifyingInputStream
-
- com.oracle.bmc.http.client.jersey3.io.internal.AutoCloseableContentLengthVerifyingInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class AutoCloseableContentLengthVerifyingInputStream extends ContentLengthVerifyingInputStream
A wrapper over anInputStreamwhose length is known, which verifies that the length of the wrapped stream matches its known length and auto-closes the stream once the content length bytes of the stream have been read.This auto-close feature has been added to release the connection from the Apache connection pool which can otherwise lead to indefinite hangs
NOTE: This implementation of auto closesable content length verification does not support
InputStream.reset()and throws an IOException when reset is called
-
-
Field Summary
-
Fields inherited from class com.oracle.bmc.http.client.jersey3.io.internal.ContentLengthVerifyingInputStream
contentLength, delegate, isVerificationEnabled, totalBytesProcessed
-
-
Constructor Summary
Constructors Constructor Description AutoCloseableContentLengthVerifyingInputStream(InputStream delegate, long contentLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()voidmark(int readlimit)booleanmarkSupported()intread()intread(byte[] b)intread(byte[] b, int off, int len)voidreset()longskip(long n)-
Methods inherited from class com.oracle.bmc.http.client.jersey3.io.internal.ContentLengthVerifyingInputStream
processBytesRead
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
AutoCloseableContentLengthVerifyingInputStream
public AutoCloseableContentLengthVerifyingInputStream(InputStream delegate, long contentLength)
-
-
Method Detail
-
read
public int read() throws IOException- Overrides:
readin classContentLengthVerifyingInputStream- Throws:
IOException
-
read
public int read(byte[] b) throws IOException- Overrides:
readin classContentLengthVerifyingInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classContentLengthVerifyingInputStream- Throws:
IOException
-
skip
public long skip(long n) throws IOException- Overrides:
skipin classContentLengthVerifyingInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classContentLengthVerifyingInputStream
-
mark
public void mark(int readlimit)
- Overrides:
markin classContentLengthVerifyingInputStream
-
reset
public void reset() throws IOException- Overrides:
resetin classContentLengthVerifyingInputStream- Throws:
IOException
-
available
public int available() throws IOException- Overrides:
availablein classContentLengthVerifyingInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classContentLengthVerifyingInputStream- Throws:
IOException
-
-