@AlfrescoPublicApi public class FileContentReader extends AbstractContentReader implements org.alfresco.service.cmr.repository.FileContentReader
This class does not provide remote access to the file.
AbstractContentAccessor.CallbackFileChannel, AbstractContentAccessor.ChannelCloseCallbackAdvise
Modifier and Type | Field and Description |
---|---|
static String |
MSG_MISSING_CONTENT
message key for missing content.
|
Constructor and Description |
---|
FileContentReader(File file)
Constructor that builds a URL based on the absolute path of the file.
|
FileContentReader(File file,
String url)
Constructor that explicitely sets the URL that the reader represents.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canWrite()
Deprecated.
Since 5.1. This method has no value: a file reader can never write (DH: 2015/02/17)
|
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 ReadableByteChannel |
getDirectReadableChannel()
Provides low-level access to read content from the repository.
|
File |
getFile() |
long |
getLastModified() |
static org.alfresco.service.cmr.repository.ContentReader |
getSafeContentReader(org.alfresco.service.cmr.repository.ContentReader existingReader,
String msgTemplate,
Object... args)
Checks the existing reader provided and replaces it with a reader onto some
fake content if required.
|
long |
getSize() |
addListener, compareContentReaders, getContent, getContent, getContentInputStream, getContentString, getContentString, getFileChannel, getLimits, getReadableChannel, getReader, getTransformerDebug, getUseBufferedInputStream, isChannelOpen, isClosed, setLimits, setTransformerDebug, setUseBufferedInputStream
channelOpened, finalize, getCallbackFileChannel, getContentData, getContentUrl, getEncoding, getLocale, getMimetype, setContentUrl, setEncoding, setLocale, setMimetype, toString
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
public static final String MSG_MISSING_CONTENT
NodeRef
ContentReader
public FileContentReader(File file)
file
- the file for reading. This will most likely be directly
related to the content URL.public static org.alfresco.service.cmr.repository.ContentReader getSafeContentReader(org.alfresco.service.cmr.repository.ContentReader existingReader, String msgTemplate, 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 contentpublic 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 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 disappeared@Deprecated public boolean canWrite()
Copyright © 2005–2017 Alfresco Software. All rights reserved.