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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
abstract void
Closes stream resource.static ASInputStream
createStreamFromStream
(ASInputStream stream) Creates copy of stream.abstract void
Method decrements number of resource users.abstract void
Method increments number of resource users.abstract int
read()
abstract int
read
(byte[] buffer, int size) abstract void
reset()
abstract int
skip
(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:
read
in classInputStream
- Throws:
IOException
-
read
- Throws:
IOException
-
skip
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
reset
- Overrides:
reset
in 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.
-