/** * 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; } } }
bytes = 0; syncState.wrote(bytes); if (bytes == 0) { endOfBitStream = true;
bytes = 0; syncState.wrote(bytes); if (bytes == 0) { endOfBitStream = true;
bytes = 0; syncState.wrote(bytes); if (bytes == 0) { endOfBitStream = true;
bytes = 0; syncState.wrote(bytes); if (bytes == 0) { endOfBitStream = true;
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=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; 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; }
int open_callbacks(InputStream is, byte[] initial, int ibytes//, callbacks callbacks ) throws JOrbisException { int ret; datasource = is; oy.init(); // perhaps some data was previously read into a buffer for testing // against other stream types. Allow initialization from this // previously read data (as we may be reading from a non-seekable // stream) if (initial != null) { int index = oy.buffer(ibytes); System.arraycopy(initial, 0, oy.data, index, ibytes); oy.wrote(ibytes); } // can we seek? Stevens suggests the seek test was portable if (is instanceof SeekableInputStream) { ret = open_seekable(); } else { ret = open_nonseekable(); } if (ret != 0) { datasource = null; clear(); } return ret; }