commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: Why not add the readFully method to IOUtils?
Date Mon, 28 Sep 2009 15:00:35 GMT
On 27/09/2009, James King <james.king.zj@gmail.com> wrote:
> Hi All,
>  Currently, there is no readFully method in IOUtils, the method that is
>  the same as the normal read(b, off, len) in java.io.InputStream, but
>  tries to ensure that the entire len number of bytes are read.
>
>  There is a readFully method in java.io.DataInput. However, this method
>  will throw EOFException if the end of file is reached before reading
>  the specified length of bytes to buf.

Are you suggesting that it is wrong to throw EOFException in this case?
How should readFully handle EOF?

>  Following are the method signatures,
>
>  public static int readFully(InputStream in, byte[] buf);
>
>  public static int readFully(InputStream in, byte[] buf, int off, int len);
>
>  My question is, why not add them to IOUtils?

Seems like a good idea to me - why not raise a JIRA enhancement issue for this?

>  James
>
>  ---------------------------------------------------------------------
>  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


Mime
View raw message