Am 14.04.2012 10:28, schrieb Martin Kirst:
Hi,

I'm interested in contribute some work to openJdk.
I found the Sun BUG:
  6341887 "Inflater.setInput(), Inflater.inflate() can't handle ByteBuffer".

After digging a little in the mailing archives I found nothing.

I've coded the first step towards ByteBuffer support.
The webrev below supports ByteBuffer for Inflater's and Deflater's
output methods.

Depending on your comments I would like to go the last step
later on. I've in mind, to implement ByteBuffer support for
input methods also, using the same approach like ByteBuffer uses.
When using direct ByteBuffer for input, you must also use it
for output. Same as ByteBuffer#hasArray(). So developers have
to use byte arrays or ByteBuffers, but not mixing them.

WebRev here:
http://dl.dropbox.com/u/52514330/6341887/webrev.00/index.html

Hi Martin, great deal.

Can't we use an Enum for variable flush ?

 484     public int deflate(ByteBuffer bbuffer, int flush) {

Then we could save things like:
 488         if ( (flush == NO_FLUSH || flush == SYNC_FLUSH || flush == 
FULL_FLUSH ) == false) {
 489             throw new IllegalArgumentException();
 490         }

Anyway there is a shorter formula:
    if (flush != NO_FLUSH && flush != SYNC_FLUSH && flush != FULL_FLUSH ) {

-Ulf


Reply via email to