}
private int buffer_data(PullSourceStream in, ogg_sync_state oy) throws IOException
{
final int BUFSIZE = 4096;
Pointer buffer = OGG.ogg_sync_buffer(oy, new NativeLong(BUFSIZE));
byte[] buffer2 = new byte[BUFSIZE]; // TODO: this is inefficient.
int bytes = in.read(buffer2, 0, BUFSIZE);
if (bytes < 0)
return bytes; // EOF
buffer.write(0, buffer2, 0, bytes);
OGG.ogg_sync_wrote(oy, new NativeLong(bytes));
return (bytes);
}