Package org.mycore.common.content
Class MCRStreamContent
java.lang.Object
org.mycore.common.content.MCRContent
org.mycore.common.content.MCRStreamContent
Reads MCRContent from an input stream. Typically, this content is not reusable, so that
content can only be read once. Please be aware that an instance of this object contains an
open input stream. Thus one has to invoke
getInputStream()
.close() when
finished with this object.- Author:
- Frank Lützenkichen
-
Field Summary
Fields inherited from class org.mycore.common.content.MCRContent
docType, encoding, lastModified, length, mimeType, name, systemId, usingSession
-
Constructor Summary
ConstructorsConstructorDescriptionMCRStreamContent
(InputStream in, String systemId) MCRStreamContent
(InputStream in, String systemId, String docType) -
Method Summary
Modifier and TypeMethodDescriptionReturns content as content input stream, which provides MD5 functionality.Returns content as input stream.boolean
Returns false, because input streams can only be read once.Methods inherited from class org.mycore.common.content.MCRContent
asByteArray, asDataURL, asString, asXML, ensureXML, getDataURLEncoding, getDocType, getEncoding, getETag, getInputSource, getMimeType, getName, getReadableByteChannel, getReusableCopy, getSafeEncoding, getSimpleWeakETag, getSource, getSystemId, isUsingSession, lastModified, length, sendTo, sendTo, sendTo, sendTo, setDocType, setEncoding, setLastModified, setMimeType, setName, setUsingSession
-
Constructor Details
-
MCRStreamContent
-
MCRStreamContent
- Parameters:
systemId
- the systemID of this stream
-
MCRStreamContent
- Parameters:
systemId
- the systemID of this stream
-
-
Method Details
-
getInputStream
Description copied from class:MCRContent
Returns content as input stream. Be sure to close this stream properly!- Specified by:
getInputStream
in classMCRContent
- Returns:
- input stream to read content from
-
getContentInputStream
Description copied from class:MCRContent
Returns content as content input stream, which provides MD5 functionality. Be sure to close this stream properly!- Overrides:
getContentInputStream
in classMCRContent
- Returns:
- the content input stream
- Throws:
IOException
-
isReusable
public boolean isReusable()Returns false, because input streams can only be read once. Use getReusableCopy() to circumvent this.- Overrides:
isReusable
in classMCRContent
-