Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.repo.content.filestore
Class FileContentWriter
java.lang.Object
  org.alfresco.repo.content.AbstractContentAccessor
      org.alfresco.repo.content.AbstractContentWriter
          org.alfresco.repo.content.filestore.FileContentWriter
All Implemented Interfaces:
ContentWriter, ContentAccessor, org.alfresco.service.cmr.repository.MimetypeServiceAware

@org.alfresco.api.AlfrescoPublicApi
public class FileContentWriter
extends AbstractContentWriter
Provides direct access to a local file.

This class does not provide remote access to the file.

Author:
Derek Hulley

Nested classes/interfaces inherited from class org.alfresco.repo.content.AbstractContentAccessor
AbstractContentAccessor.CallbackFileChannel, AbstractContentAccessor.ChannelCloseCallbackAdvise
Constructor Summary
FileContentWriter(File file)
          Constructor that builds a URL based on the absolute path of the file.
FileContentWriter(File file, String url, ContentReader existingContentReader)
          Constructor that explicitely sets the URL that the reader represents.
FileContentWriter(File file, ContentReader existingContentReader)
          Constructor that builds a URL based on the absolute path of the file.
Method Summary
boolean
canWrite()
protected 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.
getDirectWritableChannel()
          Provides low-level access to write content to the repository.
getFile()
long
getSize()
          Gets the size of the content that this reader references.
Methods inherited from class org.alfresco.repo.content.AbstractContentWriter
addListener, getContentLimitProvider, getContentOutputStream, getExistingContentReader, getFileChannel, getReader, getWritableChannel, guessEncoding, guessMimetype, isChannelOpen, isClosed, putContent, putContent, putContent, putContent, setContentLimitProvider, setMimetypeService
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
Constructor Detail
FileContentWriter
public FileContentWriter(File file)
Constructor that builds a URL based on the absolute path of the file.
Parameters:
file - the file for writing. This will most likely be directly related to the content URL.

FileContentWriter
public FileContentWriter(File file,
                         ContentReader existingContentReader)
Constructor that builds a URL based on the absolute path of the file.
Parameters:
file - the file for writing. This will most likely be directly related to the content URL.
existingContentReader - a reader of a previous version of this content

FileContentWriter
public FileContentWriter(File file,
                         String url,
                         ContentReader existingContentReader)
Constructor that explicitely sets the URL that the reader represents.
Parameters:
file - the file for writing. This will most likely be directly related to the content URL.
url - the relative url that the reader represents
existingContentReader - a reader of a previous version of this content
Method Detail
getFile
public File getFile()
Returns:
Returns the file that this writer accesses

getSize
public long getSize()
Description copied from interface: ContentAccessor
Gets the size of the content that this reader references.
Specified by:
getSize in interface ContentAccessor
Returns:
Returns the size of the underlying file or

createReader
protected ContentReader createReader()
                              throws ContentIOException
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. the stream state.
Overrides:
createReader in class AbstractContentWriter
Returns:
Returns a reader onto the location referenced by this instance. The instance must always be a new instance and never null.
Throws:
ContentIOException

getDirectWritableChannel
protected WritableByteChannel getDirectWritableChannel()
                                                throws ContentIOException
Description copied from class: AbstractContentWriter
Provides low-level access to write content to the repository.

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.

Overrides:
getDirectWritableChannel in class AbstractContentWriter
Returns:
Returns a channel with which to write content
Throws:
ContentIOException - if the channel could not be opened

canWrite
public boolean canWrite()
Returns:
Returns true always

Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2018 Alfresco Software. All rights reserved.

Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.