类 ReleasableInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- com.tencent.cos.xml.crypto.SdkFilterInputStream
-
- com.tencent.cos.xml.crypto.ReleasableInputStream
-
- 所有已实现的接口:
Releasable,java.io.Closeable,java.lang.AutoCloseable
- 直接已知子类:
ResettableInputStream
public class ReleasableInputStream extends SdkFilterInputStream implements Releasable
An input stream that can have the close operation disabled (to avoid accidentally being closed). This is necessary, for example, when an input stream needs to be marked-and-reset multiple times but only as long as the input stream has not been closed. To survive not being accidentally closed, the close method can be disabled viadisableClose().The creator of this input stream should therefore always call
release()in a finally block to truly release the underlying resources.- 另请参阅:
Releasable,ResettableInputStream
-
-
构造器概要
构造器 限定符 构造器 说明 protectedReleasableInputStream(java.io.InputStream is)This constructor is not meant to be used directly.
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 voidclose()IfcloseDisabledis false, closes this input stream and releases any system resources associated with the stream.<T extends ReleasableInputStream>
TdisableClose()Used to disable the close method.booleanisCloseDisabled()Returns true if the close method has been disabled; false otherwise.voidrelease()Closes the underlying stream file and releases any system resources associated.static ReleasableInputStreamwrap(java.io.InputStream is)Wraps the given input stream into aReleasableInputStreamif necessary.-
从类继承的方法 com.tencent.cos.xml.crypto.SdkFilterInputStream
abort, abortIfNeeded, available, isAborted, mark, markSupported, read, read, reset, skip
-
-
-
-
构造器详细资料
-
ReleasableInputStream
protected ReleasableInputStream(java.io.InputStream is)
This constructor is not meant to be used directly. Usewrap(InputStream)instead.
-
-
方法详细资料
-
close
public final void close()
IfcloseDisabledis false, closes this input stream and releases any system resources associated with the stream. Otherwise, this method does nothing.- 指定者:
close在接口中java.lang.AutoCloseable- 指定者:
close在接口中java.io.Closeable- 覆盖:
close在类中SdkFilterInputStream
-
release
public final void release()
Closes the underlying stream file and releases any system resources associated.- 指定者:
release在接口中Releasable- 覆盖:
release在类中SdkFilterInputStream
-
isCloseDisabled
public final boolean isCloseDisabled()
Returns true if the close method has been disabled; false otherwise. Once the close method is disabled, caller would be responsible to release resources viarelease().
-
disableClose
public final <T extends ReleasableInputStream> T disableClose()
Used to disable the close method. Once the close method is disabled, caller would be responsible to release resources viarelease().
-
wrap
public static ReleasableInputStream wrap(java.io.InputStream is)
Wraps the given input stream into aReleasableInputStreamif necessary. Note if the given input stream is aFileInputStream, aResettableInputStreamwhich is a specific subclass ofReleasableInputStreamwill be returned.
-
-