@NoExtend public abstract class AbstractCursorStreamProvider extends AbstractComponent implements CursorStreamProvider
CursorStreamProvider
implementations.Modifier and Type | Field and Description |
---|---|
protected InputStream |
wrappedStream |
LOCATION_KEY, ROOT_CONTAINER_NAME_KEY
ANNOTATIONS_PROPERTY_NAME
Constructor and Description |
---|
AbstractCursorStreamProvider(InputStream wrappedStream)
Creates a new instance
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the provider in the sense that it will not yield any more cursors.
|
protected abstract CursorStream |
doOpenCursor() |
boolean |
isClosed() |
CursorStream |
openCursor()
Creates a new
Cursor of type T positioned on the very beginning of the wrapped stream. |
getAnnotation, getAnnotations, getLocation, getRootContainerLocation, setAnnotations
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
releaseResources
protected final InputStream wrappedStream
public AbstractCursorStreamProvider(InputStream wrappedStream)
wrappedStream
- the original stream to be decoratedpublic final CursorStream openCursor()
Cursor
of type T
positioned on the very beginning of the wrapped stream.
Notices that this method enables concurrent random access by providing the ability to open
several cursors. However, each cursor should not be used concurrently since Cursor
does not guarantee thread safeness.
It is the invokers responsibility to make sure that the returned cursor gets closed, since otherwise whatever resources held by the underlying buffer will never be released.
openCursor
in interface CursorProvider<CursorStream>
CursorStream
public void close()
this
provider will be released.close
in interface CursorProvider<CursorStream>
public boolean isClosed()
isClosed
in interface CursorProvider<CursorStream>
CursorProvider.close()
method has been invoked on this
instance or notprotected abstract CursorStream doOpenCursor()
Copyright © 2018. All rights reserved.