|
|||||||||
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.AbstractContentWriter
public abstract class AbstractContentWriter
Implements all the convenience methods of the interface. The only methods that need to be implemented, i.e. provide low-level content access are:
AbstractContentWriter.getReader()
to create a reader to the underlying contentAbstractContentWriter.getDirectWritableChannel()
to write content to the repository
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.alfresco.repo.content.AbstractContentAccessor |
---|
AbstractContentAccessor.CallbackFileChannel, AbstractContentAccessor.ChannelCloseCallbackAdvise |
Constructor Summary | |
---|---|
protected |
AbstractContentWriter(java.lang.String contentUrl,
org.alfresco.service.cmr.repository.ContentReader existingContentReader)
|
Method Summary | |
---|---|
void |
addListener(org.alfresco.service.cmr.repository.ContentStreamListener listener)
Adds the listener after checking that the output stream isn't already in use. |
protected abstract org.alfresco.service.cmr.repository.ContentReader |
createReader()
A factory method for subclasses to implement that will ensure the proper implementation of the ContentWriter.getReader() method. |
java.io.OutputStream |
getContentOutputStream()
|
protected abstract java.nio.channels.WritableByteChannel |
getDirectWritableChannel()
Provides low-level access to write content to the repository. |
protected org.alfresco.service.cmr.repository.ContentReader |
getExistingContentReader()
|
java.nio.channels.FileChannel |
getFileChannel(boolean truncate)
|
org.alfresco.service.cmr.repository.ContentReader |
getReader()
Performs checks and copies required reader attributes |
java.nio.channels.WritableByteChannel |
getWritableChannel()
|
boolean |
isChannelOpen()
|
boolean |
isClosed()
An automatically created listener sets the flag |
void |
putContent(org.alfresco.service.cmr.repository.ContentReader reader)
|
void |
putContent(java.io.File file)
|
void |
putContent(java.io.InputStream is)
|
void |
putContent(java.lang.String content)
Makes use of the encoding, if available, to convert the string to bytes. |
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.ContentAccessor |
---|
getContentData, getContentUrl, getEncoding, getLocale, getMimetype, getSize, setEncoding, setLocale, setMimetype |
Constructor Detail |
---|
protected AbstractContentWriter(java.lang.String contentUrl, org.alfresco.service.cmr.repository.ContentReader existingContentReader)
contentUrl
- the content URLexistingContentReader
- a reader of a previous version of this contentMethod Detail |
---|
protected org.alfresco.service.cmr.repository.ContentReader getExistingContentReader()
public void addListener(org.alfresco.service.cmr.repository.ContentStreamListener listener)
addListener
in interface org.alfresco.service.cmr.repository.ContentAccessor
protected abstract org.alfresco.service.cmr.repository.ContentReader createReader() throws org.alfresco.service.cmr.repository.ContentIOException
ContentWriter.getReader()
method.
Only the instance need be constructed. The required mimetype, encoding, etc will be copied across by this class.
org.alfresco.service.cmr.repository.ContentIOException
public final org.alfresco.service.cmr.repository.ContentReader getReader() throws org.alfresco.service.cmr.repository.ContentIOException
getReader
in interface org.alfresco.service.cmr.repository.ContentWriter
org.alfresco.service.cmr.repository.ContentIOException
public final boolean isClosed()
isClosed
in interface org.alfresco.service.cmr.repository.ContentWriter
public boolean isChannelOpen()
isChannelOpen
in interface org.alfresco.service.cmr.repository.ContentAccessor
protected abstract java.nio.channels.WritableByteChannel getDirectWritableChannel() throws org.alfresco.service.cmr.repository.ContentIOException
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.
org.alfresco.service.cmr.repository.ContentIOException
- if the channel could not be openedpublic final java.nio.channels.WritableByteChannel getWritableChannel() throws org.alfresco.service.cmr.repository.ContentIOException
getWritableChannel
in interface org.alfresco.service.cmr.repository.ContentWriter
org.alfresco.service.cmr.repository.ContentIOException
AbstractContentWriter.getDirectWritableChannel()
,
#getCallbackWritableChannel()
public java.nio.channels.FileChannel getFileChannel(boolean truncate) throws org.alfresco.service.cmr.repository.ContentIOException
getFileChannel
in interface org.alfresco.service.cmr.repository.ContentWriter
org.alfresco.service.cmr.repository.ContentIOException
public java.io.OutputStream getContentOutputStream() throws org.alfresco.service.cmr.repository.ContentIOException
getContentOutputStream
in interface org.alfresco.service.cmr.repository.ContentWriter
org.alfresco.service.cmr.repository.ContentIOException
Channels.newOutputStream(java.nio.channels.WritableByteChannel)
public void putContent(org.alfresco.service.cmr.repository.ContentReader reader) throws org.alfresco.service.cmr.repository.ContentIOException
putContent
in interface org.alfresco.service.cmr.repository.ContentWriter
org.alfresco.service.cmr.repository.ContentIOException
ContentReader.getContentInputStream()
,
AbstractContentWriter.putContent(InputStream)
public final void putContent(java.io.InputStream is) throws org.alfresco.service.cmr.repository.ContentIOException
putContent
in interface org.alfresco.service.cmr.repository.ContentWriter
org.alfresco.service.cmr.repository.ContentIOException
public final void putContent(java.io.File file) throws org.alfresco.service.cmr.repository.ContentIOException
putContent
in interface org.alfresco.service.cmr.repository.ContentWriter
org.alfresco.service.cmr.repository.ContentIOException
public final void putContent(java.lang.String content) throws org.alfresco.service.cmr.repository.ContentIOException
putContent
in interface org.alfresco.service.cmr.repository.ContentWriter
org.alfresco.service.cmr.repository.ContentIOException
ContentAccessor.getEncoding()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |