Package com.saperion.rmi
Class SaRMIInputStream
java.lang.Object
java.io.InputStream
com.saperion.rmi.SaRMIInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
SaRMIInputStreamSeekable
A
InputStream
that reads data of a document identified by it's HDOC from the archive.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected int
protected byte[]
protected boolean
protected boolean
protected final int
protected final String
protected com.saperion.jni.SaJNIDocHandle
protected boolean
-
Constructor Summary
ConstructorsConstructorDescriptionSaRMIInputStream
(String hdoc, boolean currentRevision, int elementNumber, boolean withAnnotations, SaRMIClientCommand connector, Object monitor) Constructs theSaRMIInputStream
instance which represents the input stream of the document (will be returned from the Saperion backend).SaRMIInputStream
(String hdoc, boolean currentRevision, int elementNumber, SaRMIClientCommand connector, boolean dummy, Object monitor) Constructs theSaRMIInputStream
instance which represents the input stream of the document (will be returned from the Saperion backend).SaRMIInputStream
(String hdoc, boolean currentRevision, int elementNumber, SaRMIClientCommand connector, Object monitor) Constructs theSaRMIInputStream
instance which represents the input stream of the document (will be returned from the Saperion backend). -
Method Summary
Modifier and TypeMethodDescriptionint
Deprecated.void
close()
closes the input stream of the current document.int
Retrieves the document index.Retrieves the hdoc.boolean
True, if the current revision should be fetched.boolean
isDummy()
If true, no content will be read from the backend.boolean
True, if annotations should be saved on the document.boolean
Tests if this input stream supports themark
andreset
methods.int
read()
Reads the next byte of the document from the archive.protected com.saperion.jni.SaJNIReadBuffer
readDocumentFirst
(String docHdoc, boolean curRevision, int docElement, boolean withAnnotations) void
reset()
void
setFileName
(String newFileName) Methods inherited from class java.io.InputStream
mark, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, skip, skipNBytes, transferTo
-
Field Details
-
docHdoc
-
docElement
protected final int docElement -
byteBuffer
protected byte[] byteBuffer -
bufferSize
protected int bufferSize -
started
protected boolean started -
closed
protected boolean closed -
bufferPointer
protected int bufferPointer -
handle
protected com.saperion.jni.SaJNIDocHandle handle -
curRevision
protected boolean curRevision
-
-
Constructor Details
-
SaRMIInputStream
public SaRMIInputStream(String hdoc, boolean currentRevision, int elementNumber, SaRMIClientCommand connector, Object monitor) Constructs theSaRMIInputStream
instance which represents the input stream of the document (will be returned from the Saperion backend).- Parameters:
hdoc
- Document HDOCcurrentRevision
- flag indicating that the current revision of the document should be retrieved by resolving hdocelementNumber
- number of the structure-element to read fromconnector
- the rmi-client connector used to read data from the archivemonitor
- a ClassicConnector instance used to synchronize calls on the connector
-
SaRMIInputStream
public SaRMIInputStream(String hdoc, boolean currentRevision, int elementNumber, boolean withAnnotations, SaRMIClientCommand connector, Object monitor) Constructs theSaRMIInputStream
instance which represents the input stream of the document (will be returned from the Saperion backend).- Parameters:
hdoc
- Document HDOCcurrentRevision
- flag indicating that the current revision of the document should be retrieved by resolving hdocelementNumber
- number of the structure-element to read fromwithAnnotations
- if true, annotations will be saved on the document streamconnector
- the rmi-client connector used to read data from the archivemonitor
- a ClassicConnector instance used to synchronize calls on the connector
-
SaRMIInputStream
public SaRMIInputStream(String hdoc, boolean currentRevision, int elementNumber, SaRMIClientCommand connector, boolean dummy, Object monitor) Constructs theSaRMIInputStream
instance which represents the input stream of the document (will be returned from the Saperion backend).- Parameters:
hdoc
- Document HDOCcurrentRevision
- flag indicating that the current revision of the document should be retrieved by resolving hdocelementNumber
- number of the structure-element to read fromconnector
- the rmi-client connector used to read data from the archivedummy
- if true, no content will be read from the backend. Instead themonitor
- a ClassicConnector instance used to synchronize calls on the connector
-
-
Method Details
-
read
Reads the next byte of the document from the archive.- Specified by:
read
in classInputStream
- Returns:
- Next byte from stream
- Throws:
IOException
- Exception- See Also:
-
readDocumentFirst
protected com.saperion.jni.SaJNIReadBuffer readDocumentFirst(String docHdoc, boolean curRevision, int docElement, boolean withAnnotations) throws SaSystemException, SaAuthenticationException, SaGetNodeException -
close
closes the input stream of the current document.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
- Exception- See Also:
-
reset
- Overrides:
reset
in classInputStream
- Throws:
IOException
- IOException- See Also:
-
markSupported
public boolean markSupported()Tests if this input stream supports themark
andreset
methods. Whether or notmark
andreset
are supported is an invariant property of a particular input stream instance. ThemarkSupported
method ofInputStream
returnsfalse
.- Overrides:
markSupported
in classInputStream
- Returns:
true
if this stream instance supports the mark and reset methods;false
otherwise.- See Also:
-
getFileName
- Returns:
- file name
-
setFileName
- Parameters:
newFileName
- File name to set
-
available
Deprecated.- Overrides:
available
in classInputStream
- Returns:
- the number of bytes that can be read from this input stream without blocking.
- Throws:
IOException
- IO exception- See Also:
-
getDocHdoc
Retrieves the hdoc.- Returns:
- target document hdoc
-
getDocElement
public int getDocElement()Retrieves the document index.- Returns:
- document index
-
isCurrentRevision
public boolean isCurrentRevision()True, if the current revision should be fetched.- Returns:
- isCurrentRevision
-
isDummy
public boolean isDummy()If true, no content will be read from the backend. Instead the read method will always return -1.- Returns:
- isDummy
-
isWithAnnotations
public boolean isWithAnnotations()True, if annotations should be saved on the document.- Returns:
- true, if the withAnnotations flag is set to true
-