|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.repo.content.AbstractContentAccessor
org.alfresco.repo.content.AbstractContentReader
org.alfresco.repo.content.filestore.FileContentReader
public class FileContentReader
Provides direct access to a local file.
This class does not provide remote access to the file.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.alfresco.repo.content.AbstractContentAccessor |
---|
AbstractContentAccessor.CallbackFileChannel, AbstractContentAccessor.ChannelCloseCallbackAdvise |
Field Summary | |
---|---|
static java.lang.String |
MSG_MISSING_CONTENT
message key for missing content. |
Constructor Summary | |
---|---|
FileContentReader(java.io.File file)
Constructor that builds a URL based on the absolute path of the file. |
|
FileContentReader(java.io.File file,
java.lang.String url)
Constructor that explicitely sets the URL that the reader represents. |
Method Summary | |
---|---|
boolean |
canWrite()
|
protected org.alfresco.service.cmr.repository.ContentReader |
createReader()
The URL of the write is known from the start and this method contract states that no consideration needs to be taken w.r.t. |
boolean |
exists()
|
protected java.nio.channels.ReadableByteChannel |
getDirectReadableChannel()
Provides low-level access to read content from the repository. |
java.io.File |
getFile()
|
long |
getLastModified()
|
static org.alfresco.service.cmr.repository.ContentReader |
getSafeContentReader(org.alfresco.service.cmr.repository.ContentReader existingReader,
java.lang.String msgTemplate,
java.lang.Object[] args)
Checks the existing reader provided and replaces it with a reader onto some fake content if required. |
long |
getSize()
|
Methods inherited from class org.alfresco.repo.content.AbstractContentReader |
---|
addListener, compareContentReaders, getContent, getContent, getContentInputStream, getContentString, getContentString, getFileChannel, getReadableChannel, getReader, isChannelOpen, isClosed |
Methods inherited from class org.alfresco.repo.content.AbstractContentAccessor |
---|
channelOpened, finalize, getCallbackFileChannel, getContentData, getContentUrl, getEncoding, getLocale, getMimetype, setContentUrl, setEncoding, setLocale, setMimetype, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.alfresco.service.cmr.repository.ContentReader |
---|
getContent, getContent, getContentInputStream, getContentString, getContentString, getFileChannel, getReadableChannel, getReader, isClosed |
Methods inherited from interface org.alfresco.service.cmr.repository.ContentAccessor |
---|
addListener, getContentData, getContentUrl, getEncoding, getLocale, getMimetype, isChannelOpen, setEncoding, setLocale, setMimetype |
Field Detail |
---|
public static final java.lang.String MSG_MISSING_CONTENT
NodeRef
ContentReader
Constructor Detail |
---|
public FileContentReader(java.io.File file)
file
- the file for reading. This will most likely be directly
related to the content URL.public FileContentReader(java.io.File file, java.lang.String url)
file
- the file for reading. This will most likely be directly
related to the content URL.url
- the relative url that the reader representsMethod Detail |
---|
public static org.alfresco.service.cmr.repository.ContentReader getSafeContentReader(org.alfresco.service.cmr.repository.ContentReader existingReader, java.lang.String msgTemplate, java.lang.Object[] args)
It is a convenience method that clients can use to cheaply get a reader that is valid, regardless of whether the initial reader is valid.
existingReader
- a potentially invalid reader or nullmsgTemplate
- the template message that will used to format the final fake contentargs
- arguments to put into the fake content
public java.io.File getFile()
getFile
in interface org.alfresco.service.cmr.repository.FileContentReader
public boolean exists()
exists
in interface org.alfresco.service.cmr.repository.ContentReader
exists
in interface org.alfresco.service.cmr.repository.FileContentReader
public long getSize()
getSize
in interface org.alfresco.service.cmr.repository.ContentAccessor
File.length()
public long getLastModified()
getLastModified
in interface org.alfresco.service.cmr.repository.ContentReader
File.lastModified()
protected org.alfresco.service.cmr.repository.ContentReader createReader() throws org.alfresco.service.cmr.repository.ContentIOException
createReader
in class AbstractContentReader
org.alfresco.service.cmr.repository.ContentIOException
protected java.nio.channels.ReadableByteChannel getDirectReadableChannel() throws org.alfresco.service.cmr.repository.ContentIOException
AbstractContentReader
This is the only of the content reading methods that needs to be implemented by derived classes. All other content access methods make use of this in their underlying implementations.
getDirectReadableChannel
in class AbstractContentReader
org.alfresco.service.cmr.repository.ContentIOException
- if the channel could not be opened or the underlying content
has disappearedpublic boolean canWrite()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |