Subject: Re: [JGIT PATCH 2/5] Add copy(InputStream) to TemporaryBuffer

From: "Shawn O. Pearce" <[email-masked]>
Date: Thu, 11 Dec 2008 07:52:18 -0800

Robin Rosenberg <[email-masked]> wrote:
> torsdag 11 december 2008 05:58:39 skrev Shawn O. Pearce:
> > In some places we may find it ourselves with an InputStream we
> > need to copy into a TemporaryBuffer, so we can flatten out the
> > entire stream to a single byte[].  Putting the copy loop here
> > is more useful then duplicating it in application level code.
> > +	public void copy(final InputStream in) throws IOException {
> > +		final byte[] b = new byte[2048];
>
> Why not 8192 here too?

Blargh, you're right.  Actually what I should do is look to see
if blocks != null, in which case I should alloc a block and read
directly into it.  That would avoid one copy of the data.

-- 
Shawn.