[ 
https://issues.apache.org/jira/browse/HTTPCORE-43?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12488183
 ] 

Oleg Kalnichevski commented on HTTPCORE-43:
-------------------------------------------

Hi Andrea,

My very _preliminary_ plan was to provide a set of extended interfaces, which 
codecs capable of making an effective use of FileChannel (such as content 
length delimited and identity) may opt to implement in addition to base 
interfaces. Something along these lines

public interface FileContentDecoder extends ContentDecoder {

    long read(FileChannel channel, long position, long count) throws 
IOException;
    
}

public interface FileContentEncoder extends ContentEncoder {

    long write(FileChannel channel, long position, long count) throws 
IOException;

}

public class IdentityEncoder extends AbstractContentEncoder implements 
FileContentEncoder {
    
    private final WritableByteChannel channel;
   
...
 
    public IdentityEncoder(final WritableByteChannel channel) {
        super();
        if (channel == null) {
            throw new IllegalArgumentException("Channel may not be null");
        }
        this.channel = channel;
    }

    public long write(final FileChannel filechannel, long position, long count) 
throws IOException {
        if (channel == null) {
            return 0;
        }
        assertNotCompleted();
        return filechannel.transferTo(position, count, this.channel);
    }

...
    
}


If you were willing to take the first stab at it, it would be terrific.

Oleg


> Implement support for FileChannel#transferFrom and FileChannel#transferTo
> -------------------------------------------------------------------------
>
>                 Key: HTTPCORE-43
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-43
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-alpha5
>
>
> Implement optional support for FileChannel#transferFrom and 
> FileChannel#transferTo operations. Direct coping from and to FileChannel is 
> believed to result in a significant performance improvement for file bound 
> operations 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to