Package org.verapdf.as.io
Class ASInputStream
java.lang.Object
java.io.InputStream
org.verapdf.as.io.ASInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
ASConcatenatedInputStream,ASInFilter,ASInputStreamWrapper,SeekableInputStream
Base class for stream hierarchy. Has methods for resource management.
Please don't forget to close all the opened streams.
- Author:
- Timur Kamalov
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()abstract voidCloses stream resource.static ASInputStreamcreateStreamFromStream(ASInputStream stream) Creates copy of stream.abstract voidMethod decrements number of resource users.abstract voidMethod increments number of resource users.abstract intread()abstract intread(byte[] buffer, int size) abstract voidreset()abstract intskip(int size) Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, skip, skipNBytes, transferTo
-
Field Details
-
isClosed
protected boolean isClosed -
isSourceClosed
protected boolean isSourceClosed -
resourceUsers
-
-
Constructor Details
-
ASInputStream
public ASInputStream()
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Throws:
IOException
-
skip
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
closeResource
Closes stream resource. There is a difference between closing stream and closing it's resource. Several streams may have the same resource (e. g. the same file stream) and resource should be closed only after all streams using it are closed.- Throws:
IOException
-
incrementResourceUsers
public abstract void incrementResourceUsers()Method increments number of resource users. -
decrementResourceUsers
public abstract void decrementResourceUsers()Method decrements number of resource users. -
createStreamFromStream
Creates copy of stream. The two streams can be closed separately.
-