File Output Stream for partial transfer

View: New views
3 Messages — Rating Filter:   Alert me  

File Output Stream for partial transfer

by David Kocher-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

When using S3Service#getObject with a custom byte range, the file  
output stream returned by DownloadPackage#getOutputStream should  
possibly append to an existing file. Attached a patch which adds the  
append flag to the method parameter.

-David


Index: src/org/jets3t/service/multithread/DownloadPackage.java
===================================================================
RCS file: /cvs/jets3t/src/org/jets3t/service/multithread/
DownloadPackage.java,v
retrieving revision 1.6
diff -r1.6 DownloadPackage.java
104c104
<     public OutputStream getOutputStream() throws Exception {
---
 >     public OutputStream getOutputStream(boolean append) throws  
Exception {
110c110
<         OutputStream outputStream = new FileOutputStream(outputFile);
---
 >         OutputStream outputStream = new  
FileOutputStream(outputFile, append);






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

DownloadPackage.java.diff (908 bytes) Download Attachment

Re: File Output Stream for partial transfer

by James Murty-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi David,

I like your idea about making it possible to append to target files rather than just overwriting them.

However, the DownloadPackage#getOutputStream method is only generally used internally within JetS3t so I thought I decided to implement this functionality in a slightly different way to your proposed patch.

I added an appendToFile boolean flag to the DownloadPackage class. If you set this flag to true by calling the method DownloadPackage#setAppendToFile(true), the target file will be appended-to instead of overwritten.

This change has been checked into the CVS codebase. Will my change meet your needs?

Cheers,
James


On Sat, May 3, 2008 at 12:31 AM, David Kocher <dkocher@...> wrote:
When using S3Service#getObject with a custom byte range, the file output stream returned by DownloadPackage#getOutputStream should possibly append to an existing file. Attached a patch which adds the append flag to the method parameter.

-David


Index: src/org/jets3t/service/multithread/DownloadPackage.java
===================================================================
RCS file: /cvs/jets3t/src/org/jets3t/service/multithread/DownloadPackage.java,v
retrieving revision 1.6
diff -r1.6 DownloadPackage.java
104c104
<     public OutputStream getOutputStream() throws Exception {
---
>     public OutputStream getOutputStream(boolean append) throws Exception {
110c110
<         OutputStream outputStream = new FileOutputStream(outputFile);
---
>         OutputStream outputStream = new FileOutputStream(outputFile, append);





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



--
http://www.jamesmurty.com

Re: File Output Stream for partial transfer

by David Kocher-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That is perfectly fine. Thanks for the quick fix.

-David

On 03.05.2008, at 16:32, James Murty wrote:

> Hi David,
>
> I like your idea about making it possible to append to target files  
> rather
> than just overwriting them.
>
> However, the DownloadPackage#getOutputStream method is only  
> generally used
> internally within JetS3t so I thought I decided to implement this
> functionality in a slightly different way to your proposed patch.
>
> I added an appendToFile boolean flag to the DownloadPackage class.  
> If you
> set this flag to true by calling the method
> DownloadPackage#setAppendToFile(true), the target file will be  
> appended-to
> instead of overwritten.
>
> This change has been checked into the CVS codebase. Will my change  
> meet your
> needs?
>
> Cheers,
> James
>
>
> On Sat, May 3, 2008 at 12:31 AM, David Kocher <dkocher@...>  
> wrote:
>
>> When using S3Service#getObject with a custom byte range, the file  
>> output
>> stream returned by DownloadPackage#getOutputStream should possibly  
>> append to
>> an existing file. Attached a patch which adds the append flag to  
>> the method
>> parameter.
>>
>> -David
>>
>>
>> Index: src/org/jets3t/service/multithread/DownloadPackage.java
>> ===================================================================
>> RCS file:
>> /cvs/jets3t/src/org/jets3t/service/multithread/DownloadPackage.java,v
>> retrieving revision 1.6
>> diff -r1.6 DownloadPackage.java
>> 104c104
>> <     public OutputStream getOutputStream() throws Exception {
>> ---
>>>    public OutputStream getOutputStream(boolean append) throws  
>>> Exception
>> {
>> 110c110
>> <         OutputStream outputStream = new  
>> FileOutputStream(outputFile);
>> ---
>>>        OutputStream outputStream = new FileOutputStream(outputFile,
>> append);
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>
>
>
> --
> http://www.jamesmurty.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...