/** * Copys data from input stream to syncState. */ private void fetchData() throws IOException { if (!eos) { // copy 4096 bytes from compressed stream to syncState. int bufferIndex = syncState.buffer(4096); if (bufferIndex < 0) { eos = true; return; } int bytes = in.read(syncState.data, bufferIndex, 4096); syncState.wrote(bytes); if (bytes == 0) { eos = true; } } }
int index = syncState.buffer(BUFFER_SIZE); if (index >= 0) { buffer = syncState.data;
int index = syncState.buffer(BUFFER_SIZE); if (index >= 0) { buffer = syncState.data;
int index = syncState.buffer(BUFFER_SIZE); if (index >= 0) { buffer = syncState.data;
int index = syncState.buffer(BUFFER_SIZE); if (index >= 0) { buffer = syncState.data;
private void updatePcmDataHeaders (final ConverterData converterData) { // We get the new index and an updated buffer. converterData.pcmData.index = converterData.joggData.syncState.buffer (JorbisCleanConverter.BUFFER_SIZE); converterData.pcmData.buffer = converterData.joggData.syncState.data; }
private void initializeJorbis (final ConverterData converterData) { // Initialize SyncState converterData.joggData.syncState.init (); // Prepare the to SyncState internal buffer converterData.joggData.syncState.buffer (JorbisCleanConverter.BUFFER_SIZE); /* * Fill the buffer with the data from SyncState's internal buffer. Note * how the size of this new buffer is different from bufferSize. */ converterData.pcmData.buffer = converterData.joggData.syncState.data; }
public int getData() { int index = oy.buffer(CHUNKSIZE); byte[] buffer = oy.data; int bytes; try { bytes = input.read(buffer, index, CHUNKSIZE); } catch (Exception e) { return OV_EREAD; } oy.wrote(bytes); if (bytes == -1) { bytes = 0; } return bytes; }
private int get_data(){ int index=oy.buffer(CHUNKSIZE); byte[] buffer=oy.data; int bytes=0; try{ bytes=datasource.read(buffer, index, CHUNKSIZE); } catch(Exception e){ return OV_EREAD; } oy.wrote(bytes); if(bytes==-1){ bytes=0; } return bytes; }
private int get_data(){ int index=oy.buffer(CHUNKSIZE); byte[] buffer=oy.data; int bytes=0; try{ bytes=datasource.read(buffer, index, CHUNKSIZE); } catch(Exception e){ return OV_EREAD; } oy.wrote(bytes); if(bytes==-1){ bytes=0; } return bytes; }
/** * Reads in a chunk of data from the underlying input stream. * * @return true if a chunk was read, false if we've reached the end of the stream. */ protected boolean readChunk () throws IOException { int offset = _sync.buffer(BUFFER_SIZE); int bytes = _in.read(_sync.data, offset, BUFFER_SIZE); if (bytes > 0) { _sync.wrote(bytes); return true; } return false; }
private int get_data() { int index = oy.buffer(CHUNKSIZE); byte[] buffer = oy.data; int bytes; try { bytes = datasource.read(buffer, index, CHUNKSIZE); } catch (Exception e) { return OV_EREAD; } oy.wrote(bytes); if (bytes == -1) { bytes = 0; } return bytes; }
private int get_data(){ int index=oy.buffer(CHUNKSIZE); byte[] buffer=oy.data; int bytes=0; try{ bytes=datasource.read(buffer, index, CHUNKSIZE); } catch(Exception e){ return OV_EREAD; } oy.wrote(bytes); if(bytes==-1){ bytes=0; } return bytes; }
/** * Reads in a chunk of data from the underlying input stream. * * @return true if a chunk was read, false if we've reached the end of the stream. */ protected boolean readChunk () throws IOException { int offset = _sync.buffer(BUFFER_SIZE); int bytes = _in.read(_sync.data, offset, BUFFER_SIZE); if (bytes > 0) { _sync.wrote(bytes); return true; } return false; }
private boolean updatePcmDataBodyAndTellIfBodyRead (final ConverterData converterData, final InputStream oggInputStream) throws JorbisReadException { // We get the new index and an updated buffer. converterData.pcmData.index = converterData.joggData.syncState.buffer (JorbisCleanConverter.BUFFER_SIZE); converterData.pcmData.buffer = converterData.joggData.syncState.data; // Read from the oggInputStream. try { converterData.pcmData.count = oggInputStream.read (converterData.pcmData.buffer, converterData.pcmData.index, JorbisCleanConverter.BUFFER_SIZE); } catch (final IOException e) { throw new JorbisReadException ("Error while reading ogg stream", e); } // We let SyncState know how many bytes we read. converterData.joggData.syncState.wrote (converterData.pcmData.count); // Check if there's no more data in the stream. return converterData.pcmData.count == 0; }