You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Christian Grobmeier <gr...@gmail.com> on 2009/03/28 13:49:29 UTC

Re: [COMPRESS] change IOUtils.copy() to return number of bytes copied?

> IOUtils.copy() currently returns void.
> If it were changed to return a long of the number of bytes actually
> copied, then it could be used in the ArchiveInputStream test cases to
> check that the EOF was reached after the correct number of bytes. E.g.
> that would show whether any padding was being accidentally included.
>
> The only use of the class in the main code is in the ChangeSet class,
> but of course that does not have to use the return value, and the
> "wasted" code would be minimal.
>
> WDYT?

I think this would make sense and feels more consistent.
InputStream.read() returns the number of read bytes. If copy() would
do the same, this feels good to me.

Christian

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [COMPRESS] change IOUtils.copy() to return number of bytes copied?

Posted by Torsten Curdt <tc...@apache.org>.
Funny - I added that yesterday. But then reverted it as I thought we
would not need that :-p

On Sat, Mar 28, 2009 at 14:57, sebb <se...@gmail.com> wrote:
> Sorry, posted to wrong list (commons user) originally.
>
> Please continue any further discussion here - thanks!
>
> ---------- Forwarded message ----------
> From: Christian Grobmeier <gr...@gmail.com>
> Date: 28 Mar 2009 12:49
> Subject: Re: [COMPRESS] change IOUtils.copy() to return number of bytes copied?
> To: Commons Users List <us...@commons.apache.org>
>
>
>> IOUtils.copy() currently returns void.
>  > If it were changed to return a long of the number of bytes actually
>  > copied, then it could be used in the ArchiveInputStream test cases to
>  > check that the EOF was reached after the correct number of bytes. E.g.
>  > that would show whether any padding was being accidentally included.
>  >
>  > The only use of the class in the main code is in the ChangeSet class,
>  > but of course that does not have to use the return value, and the
>  > "wasted" code would be minimal.
>  >
>  > WDYT?
>
>
> I think this would make sense and feels more consistent.
>  InputStream.read() returns the number of read bytes. If copy() would
>  do the same, this feels good to me.
>
>  Christian
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>  For additional commands, e-mail: user-help@commons.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Fwd: [COMPRESS] change IOUtils.copy() to return number of bytes copied?

Posted by sebb <se...@gmail.com>.
Sorry, posted to wrong list (commons user) originally.

Please continue any further discussion here - thanks!

---------- Forwarded message ----------
From: Christian Grobmeier <gr...@gmail.com>
Date: 28 Mar 2009 12:49
Subject: Re: [COMPRESS] change IOUtils.copy() to return number of bytes copied?
To: Commons Users List <us...@commons.apache.org>


> IOUtils.copy() currently returns void.
 > If it were changed to return a long of the number of bytes actually
 > copied, then it could be used in the ArchiveInputStream test cases to
 > check that the EOF was reached after the correct number of bytes. E.g.
 > that would show whether any padding was being accidentally included.
 >
 > The only use of the class in the main code is in the ChangeSet class,
 > but of course that does not have to use the return value, and the
 > "wasted" code would be minimal.
 >
 > WDYT?


I think this would make sense and feels more consistent.
 InputStream.read() returns the number of read bytes. If copy() would
 do the same, this feels good to me.

 Christian

 ---------------------------------------------------------------------
 To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
 For additional commands, e-mail: user-help@commons.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [COMPRESS] change IOUtils.copy() to return number of bytes copied?

Posted by sebb <se...@gmail.com>.
Oops, sorry, the original message was supposed to be posted to the
Commons Developer List.

I'll forward it there - please don't reply further here, thanks!.

On 28/03/2009, Christian Grobmeier <gr...@gmail.com> wrote:
> > IOUtils.copy() currently returns void.
>  > If it were changed to return a long of the number of bytes actually
>  > copied, then it could be used in the ArchiveInputStream test cases to
>  > check that the EOF was reached after the correct number of bytes. E.g.
>  > that would show whether any padding was being accidentally included.
>  >
>  > The only use of the class in the main code is in the ChangeSet class,
>  > but of course that does not have to use the return value, and the
>  > "wasted" code would be minimal.
>  >
>  > WDYT?
>
>
> I think this would make sense and feels more consistent.
>  InputStream.read() returns the number of read bytes. If copy() would
>  do the same, this feels good to me.
>
>  Christian
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>  For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org