|
Constructor Summary | ||
protected |
AbstractContentWriter(String contentUrl, ContentReader existingContentReader) |
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. |
|
protected abstract ContentReader |
createReader() A factory method for subclasses to implement that will ensure the proper implementation of the ContentWriter.getReader() method. |
|
protected void |
finalize() | |
protected FileChannel |
getCallbackFileChannel(FileChannel directChannel, List<ContentStreamListener> listeners) Generate a callback instance of the FileChannel. |
|
getContentData() Get the data representation of the content being accessed. |
||
protected org.alfresco.repo.content.ContentLimitProvider |
getContentLimitProvider() This method returns the configured ContentLimitProvider for this writer. |
|
getContentOutputStream() Get a stream to write to the underlying channel. |
||
getContentUrl() Retrieve the URL that this accessor references |
||
protected abstract WritableByteChannel |
getDirectWritableChannel() Provides low-level access to write content to the repository. |
|
getEncoding() Get the encoding of the content being accessed |
||
protected ContentReader |
getExistingContentReader() | |
getFileChannel(boolean truncate) Provides read-write, random-access to the underlying content. |
||
getLocale() Get the locale of the content being accessed |
||
getMimetype() Get the content mimetype |
||
getReader() Performs checks and copies required reader attributes |
||
getWritableChannel() Provides low-level access to write to repository content. |
||
void |
guessEncoding() When the content has been written, attempt to guess the encoding of it. |
|
void |
guessMimetype(String filename) When the content has been written, attempt to guess the mimetype of it, using the filename and contents. |
|
boolean |
isChannelOpen() Gets the open/close state of the underlying IO Channel. |
|
boolean |
isClosed() An automatically created listener sets the flag |
|
void |
putContent(ContentReader reader) Copies content from the reader. |
|
void |
putContent(File file) Puts content to the repository direct from file |
|
void |
putContent(InputStream is) Puts content to the repository |
|
void |
putContent(String content) Makes use of the encoding, if available, to convert the string to bytes. |
|
void |
setContentLimitProvider(org.alfresco.repo.content.ContentLimitProvider limitProvider) | |
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 |
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 |
setMimetypeService(MimetypeService mimetypeService) Supplies the Mimetype Service to be used when guessing encoding and mimetype information. |
|
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 |
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 writing methods that needs to be implemented by derived classes. All other content access methods make use of this in their underlying implementations.
The channel returned to the client should remain open (subject to timeouts) until closed by the client. All lock detection, read-only access and other concurrency issues are dealt with during this operation. It remains possible that implementations will throw exceptions when the channel is closed.
The stream will notify any listeners according to the listener interface.
Underlying implementations use the truncate
parameter to determine the
most effective means of providing access to the content.
All resources will be closed automatically.
All resources will be closed automatically.
All resources will be closed automatically.
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
|