Package org.mycore.common.content
Class MCRByteContent
java.lang.Object
org.mycore.common.content.MCRContent
org.mycore.common.content.MCRByteContent
Reads MCRContent from a byte[] array.
- Author:
- Frank Lützenkichen
-
Field Summary
Fields inherited from class org.mycore.common.content.MCRContent
docType, encoding, mimeType, name, systemId, usingSession
-
Constructor Summary
ConstructorDescriptionMCRByteContent
(byte[] bytes) MCRByteContent
(byte[] bytes, int offset, int length) MCRByteContent
(byte[] bytes, int offset, int length, long lastModified) MCRByteContent
(byte[] bytes, long lastModified) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Returns the raw contentgetETag()
Returns either strong or weak ETag.Returns content as input stream.long
Returns the last modified timelong
length()
Return the length of this content.void
setSystemId
(String systemId) Methods inherited from class org.mycore.common.content.MCRContent
asDataURL, asString, asXML, ensureXML, getContentInputStream, getDataURLEncoding, getDocType, getEncoding, getInputSource, getMimeType, getName, getReadableByteChannel, getReusableCopy, getSafeEncoding, getSimpleWeakETag, getSource, getSystemId, isReusable, isUsingSession, sendTo, sendTo, sendTo, sendTo, setDocType, setEncoding, setLastModified, setMimeType, setName, setUsingSession
-
Constructor Details
-
MCRByteContent
public MCRByteContent(byte[] bytes) -
MCRByteContent
public MCRByteContent(byte[] bytes, int offset, int length) -
MCRByteContent
public MCRByteContent(byte[] bytes, long lastModified) -
MCRByteContent
public MCRByteContent(byte[] bytes, int offset, int length, long lastModified)
-
-
Method Details
-
setSystemId
-
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
-
asByteArray
public byte[] asByteArray()Description copied from class:MCRContent
Returns the raw content- Overrides:
asByteArray
in classMCRContent
- Returns:
- the content
-
length
public long length()Description copied from class:MCRContent
Return the length of this content.- Overrides:
length
in classMCRContent
- Returns:
- -1 if length is unknown
-
lastModified
public long lastModified()Description copied from class:MCRContent
Returns the last modified time- Overrides:
lastModified
in classMCRContent
- Returns:
- -1 if last modified time is unknown
-
getETag
Description copied from class:MCRContent
Returns either strong or weak ETag.- Overrides:
getETag
in classMCRContent
- Returns:
- null, if no ETag could be generated
-