Message562

Author kevinbutler
Recipients
Date 2002-03-07.17:29:57
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=117665

I'm uncomfortable with a couple of aspects of this patch -
the use of a member variable 'buf' makes the class loading
process not thread safe (can ClassLoaders be used in 
multiple threads?). Also, this will retain a buffer as large 
as the largest class loaded in the process.

It would probably be better to have a getBytes method 
something like:

protected byte[] getBytes( InputStream s )
{
  int bufsize=4096;
  byte[] buf = new byte[ bufsize ];
  ByteArrayOutputStream out = new ByteArrayOutputStream( 
bufsize );
  int count;
  while( true )
  {
    count = in.read( buf, 0, bufsize );
    if ( count < 0 )
      break;
    out.write( buf, 0, count );
  }
  return out.getBytes();
}     
History
Date User Action Args
2008-02-20 17:17:00adminlinkissue511493 messages
2008-02-20 17:17:00admincreate