org.wso2.carbon.registry.core.jdbc.utils
Class VersionInputStream
java.lang.Object
java.io.InputStream
org.wso2.carbon.registry.core.jdbc.utils.VersionInputStream
- All Implemented Interfaces:
- Closeable
public class VersionInputStream
- extends InputStream
This is an implementation of an input stream, wrapping the version list content written to the
database. This stream is capable of serializing a list of versions into a stream of bytes. The
byte stream will then be stored on the database, and will be much more optimal than storing them
one by one.
The version retriever can read through such a stream of bytes and obtain the list of versions.
- See Also:
VersionRetriever
Method Summary |
int |
available()
Method to check whether anymore bytes are left to read. |
int |
read()
Reads the stream one by one. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VersionInputStream
public VersionInputStream(List<Long> versionList)
- Creates a version input stream from the given list of versions.
- Parameters:
versionList
- list of versions.
read
public int read()
throws IOException
- Reads the stream one by one.
- Specified by:
read
in class InputStream
- Returns:
- the value to be read.
- Throws:
IOException
- if an error occurs.
available
public int available()
throws IOException
- Method to check whether anymore bytes are left to read.
- Overrides:
available
in class InputStream
- Returns:
- the number of versions to be read.
- Throws:
IOException
- if an error occurs.
Copyright © 2013 WSO2 Inc. All Rights Reserved.