mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
AR-383: Optimized overwrite behaviour for ContentWriter. Content will only be duplicated for the writes if explicitly requesting a random-access file without the truncate option
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2254 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -45,6 +45,10 @@ public interface ContentAccessor
|
||||
|
||||
/**
|
||||
* Set the transaction provider that will be used when stream listeners are called.
|
||||
* No transactions are started unless there are listeners present to be executed.
|
||||
* For consistency, the execution of listeners <b>will not</b> be allowed to proceed
|
||||
* unless this property has been set OR the channel close operations are executed
|
||||
* within the context of a live transaction.
|
||||
*
|
||||
* @param transactionService a transaction provider
|
||||
*/
|
||||
|
@@ -19,6 +19,7 @@ package org.alfresco.service.cmr.repository;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
|
||||
/**
|
||||
@@ -86,6 +87,19 @@ public interface ContentReader extends ContentAccessor
|
||||
*/
|
||||
public ReadableByteChannel getReadableChannel() throws ContentIOException;
|
||||
|
||||
/**
|
||||
* Provides read-only, random-access to the underlying content. In general, this method
|
||||
* should be considered more expensive than the sequential-access method,
|
||||
* {@link #getReadableChannel()}.
|
||||
*
|
||||
* @return Returns a random-access channel onto the content
|
||||
* @throws ContentIOException
|
||||
*
|
||||
* @see #getReadableChannel()
|
||||
* @see java.io.RandomAccessFile#getChannel()
|
||||
*/
|
||||
public FileChannel getFileChannel() throws ContentIOException;
|
||||
|
||||
/**
|
||||
* Get a stream to read from the underlying channel
|
||||
*
|
||||
|
@@ -19,6 +19,7 @@ package org.alfresco.service.cmr.repository;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.WritableByteChannel;
|
||||
|
||||
|
||||
@@ -77,6 +78,23 @@ public interface ContentWriter extends ContentAccessor
|
||||
*/
|
||||
public WritableByteChannel getWritableChannel() throws ContentIOException;
|
||||
|
||||
/**
|
||||
* Provides read-write, random-access to the underlying content. In general, this method
|
||||
* should be considered more expensive than the sequential-access method,
|
||||
* {@link #getWritableChannel()}.
|
||||
* <p>
|
||||
* Underlying implementations use the <code>truncate</code> parameter to determine the
|
||||
* most effective means of providing access to the content.
|
||||
*
|
||||
* @param truncate true to start with zero length content
|
||||
* @return Returns a random-access channel onto the content
|
||||
* @throws ContentIOException
|
||||
*
|
||||
* @see #getWritableChannel()
|
||||
* @see java.io.RandomAccessFile#getChannel()
|
||||
*/
|
||||
public FileChannel getFileChannel(boolean truncate) throws ContentIOException;
|
||||
|
||||
/**
|
||||
* Get a stream to write to the underlying channel.
|
||||
*
|
||||
|
Reference in New Issue
Block a user