Package org.mycore.common.content
Class MCRPathContent
java.lang.Object
org.mycore.common.content.MCRContent
org.mycore.common.content.MCRPathContent
- All Implemented Interfaces:
MCRSeekableChannelContent
- Direct Known Subclasses:
MCRFileContent
MCRContent implementation that uses Java 7
FileSystem
features.- Author:
- Thomas Scheffler (yagee)
-
Field Summary
Fields inherited from class org.mycore.common.content.MCRContent
docType, encoding, lastModified, length, mimeType, name, systemId, usingSession
-
Constructor Summary
ConstructorDescriptionMCRPathContent
(Path path) MCRPathContent
(Path path, BasicFileAttributes attrs) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Returns the raw contentgetETag()
Returns either strong or weak ETag.Returns content as input stream.getName()
Returns an readable bytechannel to this content or null if one is not available.Returns the systemID of the current contentlong
Returns the last modified timelong
length()
Return the length of this content.void
Sends content to the given local filevoid
sendTo
(OutputStream out) Sends content to the given OutputStream.void
sendTo
(Path target, CopyOption... options) Sends content to the given path.Methods inherited from class org.mycore.common.content.MCRContent
asDataURL, asString, asXML, ensureXML, getContentInputStream, getDataURLEncoding, getDocType, getEncoding, getInputSource, getReusableCopy, getSafeEncoding, getSimpleWeakETag, getSource, isReusable, isUsingSession, sendTo, setDocType, setEncoding, setLastModified, setMimeType, setName, setUsingSession
-
Constructor Details
-
MCRPathContent
-
MCRPathContent
-
-
Method Details
-
getSeekableByteChannel
- Specified by:
getSeekableByteChannel
in interfaceMCRSeekableChannelContent
- Throws:
IOException
-
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
- Throws:
IOException
-
getReadableByteChannel
Description copied from class:MCRContent
Returns an readable bytechannel to this content or null if one is not available.- Overrides:
getReadableByteChannel
in classMCRContent
- Throws:
IOException
-
asByteArray
Description copied from class:MCRContent
Returns the raw content- Overrides:
asByteArray
in classMCRContent
- Returns:
- the content
- Throws:
IOException
-
length
Description copied from class:MCRContent
Return the length of this content.- Overrides:
length
in classMCRContent
- Returns:
- -1 if length is unknown
- Throws:
IOException
-
lastModified
Description copied from class:MCRContent
Returns the last modified time- Overrides:
lastModified
in classMCRContent
- Returns:
- -1 if last modified time is unknown
- Throws:
IOException
-
getETag
Description copied from class:MCRContent
Returns either strong or weak ETag.- Overrides:
getETag
in classMCRContent
- Returns:
- null, if no ETag could be generated
- Throws:
IOException
-
getMimeType
- Overrides:
getMimeType
in classMCRContent
- Throws:
IOException
-
getSystemId
Description copied from class:MCRContent
Returns the systemID of the current content- Overrides:
getSystemId
in classMCRContent
-
getName
- Overrides:
getName
in classMCRContent
-
sendTo
Description copied from class:MCRContent
Sends content to the given OutputStream. The OutputStream is NOT automatically closed afterwards.- Overrides:
sendTo
in classMCRContent
- Parameters:
out
- the OutputStream to write the content to- Throws:
IOException
-
sendTo
Description copied from class:MCRContent
Sends content to the given local file- Overrides:
sendTo
in classMCRContent
- Parameters:
target
- the file to write the content to- Throws:
IOException
-
sendTo
Description copied from class:MCRContent
Sends content to the given path.- Overrides:
sendTo
in classMCRContent
- Parameters:
target
- target path to write content tooptions
- seeFiles.copy(InputStream, Path, CopyOption...)
} for help on copy options- Throws:
IOException
-