Class DataSource
java.lang.Object
com.github.cafapi.common.util.ref.DataSource
- Direct Known Subclasses:
DataStoreSource
Interface for defining how to retrieve objects or streams from a reference.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract long
getDataSize
(String ref) Determine the size of the data abstracted.abstract <T> T
Retrieve an object of the specified class identified by a specific reference.abstract InputStream
Retrieve a stream of data identified by a specific reference.
-
Constructor Details
-
DataSource
public DataSource()
-
-
Method Details
-
getObject
Retrieve an object of the specified class identified by a specific reference.- Type Parameters:
T
- the type of the object instance- Parameters:
ref
- the reference that points to an instance of an object of the specified classclazz
- the class of the object instance the reference points to- Returns:
- the object instance of the specified class identified by the specified reference
- Throws:
DataSourceException
- if the object instance cannot be acquired
-
getStream
Retrieve a stream of data identified by a specific reference.- Parameters:
ref
- the reference that points to a stream of data- Returns:
- a stream of data identified by the specified reference
- Throws:
DataSourceException
- if the data stream cannot be acquired
-
getDataSize
Determine the size of the data abstracted.- Parameters:
ref
- the reference that points to the data- Returns:
- the size of the data, in bytes
- Throws:
DataSourceException
- if the data size cannot be acquired
-