james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Wiederkehr <markus.wiederk...@gmail.com>
Subject ThreadLocal in CodecUtil.copy()?
Date Mon, 17 Aug 2009 14:22:40 GMT
CodecUtil.copy(InputStream, OutputStream) allocates a new byte array
with 1024 bytes on each invocation.

I wonder if we could use a ThreadLocal instead so that the buffer
could be reused within the same thread? Buffers would automatically be
freed once their thread terminates.. I'd reduce the size to 512 bytes
though.

This way methods like DecoderUtil.decodeBase64() could use copy() even
if they need only copy a few bytes.

Opinions?

Markus

Mime
View raw message