|
Constructor Summary | ||
protected |
AbstractContentReader(String contentUrl) |
Method Summary | ||
void |
addListener(ContentStreamListener listener) Adds the listener after checking that the output stream isn't already in use. |
|
protected void |
channelOpened() Derived classes can call this method to ensure that necessary trace logging is performed when the IO Channel is opened. |
|
static boolean |
compareContentReaders(ContentReader left, ContentReader right) Does a comparison of the binaries associated with two readers. |
|
protected abstract ContentReader |
createReader() A factory method for subclasses to implement that will ensure the proper implementation of the ContentReader.getReader() method. |
|
protected void |
finalize() | |
protected FileChannel |
getCallbackFileChannel(FileChannel directChannel, List<ContentStreamListener> listeners) Generate a callback instance of the FileChannel. |
|
void |
getContent(File file) Gets content from the repository direct to file |
|
void |
getContent(OutputStream os) Copies the input stream to the given OutputStream |
|
getContentData() Get the data representation of the content being accessed. |
||
getContentInputStream() Get a stream to read from the underlying channel |
||
getContentString() Makes use of the encoding, if available, to convert bytes to a string. |
||
getContentString(int length) Gets content from the repository direct to String , but limiting the string size to a given number of characters. |
||
getContentUrl() Retrieve the URL that this accessor references |
||
protected abstract ReadableByteChannel |
getDirectReadableChannel() Provides low-level access to read content from the repository. |
|
getEncoding() Get the encoding of the content being accessed |
||
getFileChannel() Provides read-only, random-access to the underlying content. |
||
getLimits() | ||
getLocale() Get the locale of the content being accessed |
||
getMimetype() Get the content mimetype |
||
getReadableChannel() Provides low-level access to the underlying content. |
||
getReader() Performs checks and copies required reader attributes |
||
getTransformerDebug() | ||
boolean |
getUseBufferedInputStream() | |
boolean |
isChannelOpen() Gets the open/close state of the underlying IO Channel. |
|
boolean |
isClosed() An automatically created listener sets the flag |
|
protected void |
setContentUrl(String contentUrl) Allow derived implementations to set the Content URL. |
|
void |
setEncoding(String encoding) Set the String encoding for this accessor |
|
void |
setLimits(TransformationOptionLimits limits) | |
void |
setLocale(Locale locale) Set the Locale for this accessor |
|
void |
setMimetype(String mimetype) Set the mimetype that must be used for accessing the content. |
|
void |
setTransformerDebug(TransformerDebug transformerDebug) | |
void |
setUseBufferedInputStream(boolean useBufferedInputStream) | |
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.ContentAccessor |
getSize |
Methods inherited from interface org.alfresco.service.cmr.repository.ContentReader |
exists, getLastModified |
Only the instance need be constructed. The required mimetype, encoding, etc will be copied across by this class.
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.
Once the stream is provided to a client it should remain active (subject to any timeouts) until closed by the client.
OutputStream
All resources will be closed automatically.
String
, but limiting
the string size to a given number of characters.
If the encoding is known then it will be used otherwise the default system byte[] to String conversion will be used.
All resources will be closed automatically.
All the content is streamed into memory. So, like the interface said, be careful with this method.
The content mimetype must be set before this method is called as the content data requires a mimetype whenever the content URL is specified.
When dealing with a ContentWriter, you may wish to use ContentWriter.guessMimetype(String) to have this set for you based on the filename and contents.
String
encoding for this accessor
When dealing with a ContentWriter, you may wish to use ContentWriter.guessMimetype(String) to have this set for you based on the contents.
Locale
for this accessor
|