mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-10-03 23:53:15 -04:00
TMC-IOENC: Encoder implementation clean-up.
This commit is contained in:
@@ -30,6 +30,7 @@ package com.twelvemonkeys.io.enc;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.zip.Deflater;
|
||||
|
||||
/**
|
||||
@@ -62,12 +63,12 @@ final class DeflateEncoder implements Encoder {
|
||||
deflater = pDeflater;
|
||||
}
|
||||
|
||||
public void encode(final OutputStream pStream, final byte[] pBuffer, final int pOffset, final int pLength)
|
||||
public void encode(final OutputStream stream, ByteBuffer buffer)
|
||||
throws IOException
|
||||
{
|
||||
System.out.println("DeflateEncoder.encode");
|
||||
deflater.setInput(pBuffer, pOffset, pLength);
|
||||
flushInputToStream(pStream);
|
||||
deflater.setInput(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining());
|
||||
flushInputToStream(stream);
|
||||
}
|
||||
|
||||
private void flushInputToStream(final OutputStream pStream) throws IOException {
|
||||
|
Reference in New Issue
Block a user