本文整理了Java中javazoom.jl.decoder.Bitstream.newBitstreamException()
方法的一些代码示例,展示了Bitstream.newBitstreamException()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bitstream.newBitstreamException()
方法的具体详情如下:
包路径:javazoom.jl.decoder.Bitstream
类名称:Bitstream
方法名:newBitstreamException
暂无
代码示例来源:origin: com.badlogicgames.jlayer/jlayer
/**
* Unreads the bytes read from the frame.
* @throws BitstreamException
*/
// REVIEW: add new error codes for this.
public void unreadFrame () throws BitstreamException {
if (wordpointer == -1 && bitindex == -1 && framesize > 0) try {
source.unread(frame_bytes, 0, framesize);
} catch (IOException ex) {
throw newBitstreamException(STREAM_ERROR);
}
}
代码示例来源:origin: tulskiy/musique
/**
* Unreads the bytes read from the frame.
*
* @throws BitstreamException
*/
// REVIEW: add new error codes for this.
public void unreadFrame() throws BitstreamException {
if (wordpointer == -1 && bitindex == -1 && (framesize > 0)) {
try {
source.unread(frame_bytes, 0, framesize);
} catch (IOException ex) {
throw newBitstreamException(STREAM_ERROR);
}
}
}
代码示例来源:origin: com.badlogicgames.jlayer/jlayer
/**
* Simlar to readFully, but doesn't throw exception when EOF is reached.
*/
private int readBytes (byte[] b, int offs, int len) throws BitstreamException {
int totalBytesRead = 0;
try {
while (len > 0) {
int bytesread = source.read(b, offs, len);
if (bytesread == -1) break;
totalBytesRead += bytesread;
offs += bytesread;
len -= bytesread;
}
} catch (IOException ex) {
throw newBitstreamException(STREAM_ERROR, ex);
}
return totalBytesRead;
}
代码示例来源:origin: javazoom/jlayer
/**
* Unreads the bytes read from the frame.
* @throws BitstreamException
*/
// REVIEW: add new error codes for this.
public void unreadFrame() throws BitstreamException
{
if (wordpointer==-1 && bitindex==-1 && (framesize>0))
{
try
{
source.unread(frame_bytes, 0, framesize);
}
catch (IOException ex)
{
throw newBitstreamException(STREAM_ERROR);
}
}
}
代码示例来源:origin: pdudits/soundlibs
/**
* Unreads the bytes read from the frame.
* @throws BitstreamException
*/
// REVIEW: add new error codes for this.
public void unreadFrame() throws BitstreamException
{
if (wordpointer==-1 && bitindex==-1 && (framesize>0))
{
try
{
source.unread(frame_bytes, 0, framesize);
}
catch (IOException ex)
{
throw newBitstreamException(STREAM_ERROR);
}
}
}
代码示例来源:origin: com.googlecode.soundlibs/jlayer
/**
* Unreads the bytes read from the frame.
* @throws BitstreamException
*/
// REVIEW: add new error codes for this.
public void unreadFrame() throws BitstreamException
{
if (wordpointer==-1 && bitindex==-1 && (framesize>0))
{
try
{
source.unread(frame_bytes, 0, framesize);
}
catch (IOException ex)
{
throw newBitstreamException(STREAM_ERROR);
}
}
}
代码示例来源:origin: javazoom/jlayer
/**
* Simlar to readFully, but doesn't throw exception when
* EOF is reached.
*/
private int readBytes(byte[] b, int offs, int len)
throws BitstreamException
{
int totalBytesRead = 0;
try
{
while (len > 0)
{
int bytesread = source.read(b, offs, len);
if (bytesread == -1)
{
break;
}
totalBytesRead += bytesread;
offs += bytesread;
len -= bytesread;
}
}
catch (IOException ex)
{
throw newBitstreamException(STREAM_ERROR, ex);
}
return totalBytesRead;
}
}
代码示例来源:origin: com.badlogicgames.jlayer/jlayer
/**
* Reads the exact number of bytes from the source input stream into a byte array.
*
* @param b The byte array to read the specified number of bytes into.
* @param offs The index in the array where the first byte read should be stored.
* @param len the number of bytes to read.
*
* @exception BitstreamException is thrown if the specified number of bytes could not be read from the stream.
*/
private int readFully (byte[] b, int offs, int len) throws BitstreamException {
int nRead = 0;
try {
while (len > 0) {
int bytesread = source.read(b, offs, len);
if (bytesread == -1) {
while (len-- > 0)
b[offs++] = 0;
break;
// throw newBitstreamException(UNEXPECTED_EOF, new EOFException());
}
nRead = nRead + bytesread;
offs += bytesread;
len -= bytesread;
}
} catch (IOException ex) {
throw newBitstreamException(STREAM_ERROR, ex);
}
return nRead;
}
代码示例来源:origin: com.googlecode.soundlibs/jlayer
/**
* Simlar to readFully, but doesn't throw exception when
* EOF is reached.
*/
private int readBytes(byte[] b, int offs, int len)
throws BitstreamException
{
int totalBytesRead = 0;
try
{
while (len > 0)
{
int bytesread = source.read(b, offs, len);
if (bytesread == -1)
{
break;
}
totalBytesRead += bytesread;
offs += bytesread;
len -= bytesread;
}
}
catch (IOException ex)
{
throw newBitstreamException(STREAM_ERROR, ex);
}
return totalBytesRead;
}
}
代码示例来源:origin: pdudits/soundlibs
/**
* Simlar to readFully, but doesn't throw exception when
* EOF is reached.
*/
private int readBytes(byte[] b, int offs, int len)
throws BitstreamException
{
int totalBytesRead = 0;
try
{
while (len > 0)
{
int bytesread = source.read(b, offs, len);
if (bytesread == -1)
{
break;
}
totalBytesRead += bytesread;
offs += bytesread;
len -= bytesread;
}
}
catch (IOException ex)
{
throw newBitstreamException(STREAM_ERROR, ex);
}
return totalBytesRead;
}
}
代码示例来源:origin: com.badlogicgames.jlayer/jlayer
/**
* Close the Bitstream.
* @throws BitstreamException
*/
public void close () throws BitstreamException {
try {
source.close();
} catch (IOException ex) {
throw newBitstreamException(STREAM_ERROR, ex);
}
}
代码示例来源:origin: tulskiy/musique
throw newBitstreamException(STREAM_ERROR, ex);
代码示例来源:origin: javazoom/jlayer
/**
* Close the Bitstream.
* @throws BitstreamException
*/
public void close() throws BitstreamException
{
try
{
source.close();
}
catch (IOException ex)
{
throw newBitstreamException(STREAM_ERROR, ex);
}
}
代码示例来源:origin: com.googlecode.soundlibs/jlayer
/**
* Close the Bitstream.
* @throws BitstreamException
*/
public void close() throws BitstreamException
{
try
{
source.close();
}
catch (IOException ex)
{
throw newBitstreamException(STREAM_ERROR, ex);
}
}
代码示例来源:origin: pdudits/soundlibs
/**
* Close the Bitstream.
* @throws BitstreamException
*/
public void close() throws BitstreamException
{
try
{
source.close();
}
catch (IOException ex)
{
throw newBitstreamException(STREAM_ERROR, ex);
}
}
代码示例来源:origin: com.badlogicgames.jlayer/jlayer
/**
* Get next 32 bits from bitstream. They are stored in the headerstring. syncmod allows Synchro flag ID The returned value is
* False at the end of stream.
*/
int syncHeader (byte syncmode) throws BitstreamException {
boolean sync;
int headerstring;
// read additional 2 bytes
int bytesRead = readBytes(syncbuf, 0, 3);
if (bytesRead != 3) throw newBitstreamException(STREAM_EOF, null);
headerstring = syncbuf[0] << 16 & 0x00FF0000 | syncbuf[1] << 8 & 0x0000FF00 | syncbuf[2] << 0 & 0x000000FF;
do {
headerstring <<= 8;
if (readBytes(syncbuf, 3, 1) != 1) throw newBitstreamException(STREAM_EOF, null);
headerstring |= syncbuf[3] & 0x000000FF;
sync = isSyncMark(headerstring, syncmode, syncword);
} while (!sync);
// current_frame_number++;
// if (last_frame_number < current_frame_number) last_frame_number = current_frame_number;
return headerstring;
}
代码示例来源:origin: com.googlecode.soundlibs/jlayer
/**
* Get next 32 bits from bitstream.
* They are stored in the headerstring.
* syncmod allows Synchro flag ID
* The returned value is False at the end of stream.
*/
int syncHeader(byte syncmode) throws BitstreamException
{
boolean sync;
int headerstring;
// read additional 2 bytes
int bytesRead = readBytes(syncbuf, 0, 3);
if (bytesRead!=3) throw newBitstreamException(STREAM_EOF, null);
headerstring = ((syncbuf[0] << 16) & 0x00FF0000) | ((syncbuf[1] << 8) & 0x0000FF00) | ((syncbuf[2] << 0) & 0x000000FF);
do
{
headerstring <<= 8;
if (readBytes(syncbuf, 3, 1)!=1)
throw newBitstreamException(STREAM_EOF, null);
headerstring |= (syncbuf[3] & 0x000000FF);
sync = isSyncMark(headerstring, syncmode, syncword);
}
while (!sync);
//current_frame_number++;
//if (last_frame_number < current_frame_number) last_frame_number = current_frame_number;
return headerstring;
}
代码示例来源:origin: javazoom/jlayer
/**
* Get next 32 bits from bitstream.
* They are stored in the headerstring.
* syncmod allows Synchro flag ID
* The returned value is False at the end of stream.
*/
int syncHeader(byte syncmode) throws BitstreamException
{
boolean sync;
int headerstring;
// read additional 2 bytes
int bytesRead = readBytes(syncbuf, 0, 3);
if (bytesRead!=3) throw newBitstreamException(STREAM_EOF, null);
headerstring = ((syncbuf[0] << 16) & 0x00FF0000) | ((syncbuf[1] << 8) & 0x0000FF00) | ((syncbuf[2] << 0) & 0x000000FF);
do
{
headerstring <<= 8;
if (readBytes(syncbuf, 3, 1)!=1)
throw newBitstreamException(STREAM_EOF, null);
headerstring |= (syncbuf[3] & 0x000000FF);
sync = isSyncMark(headerstring, syncmode, syncword);
}
while (!sync);
//current_frame_number++;
//if (last_frame_number < current_frame_number) last_frame_number = current_frame_number;
return headerstring;
}
代码示例来源:origin: pdudits/soundlibs
/**
* Get next 32 bits from bitstream.
* They are stored in the headerstring.
* syncmod allows Synchro flag ID
* The returned value is False at the end of stream.
*/
int syncHeader(byte syncmode) throws BitstreamException
{
boolean sync;
int headerstring;
// read additional 2 bytes
int bytesRead = readBytes(syncbuf, 0, 3);
if (bytesRead!=3) throw newBitstreamException(STREAM_EOF, null);
headerstring = ((syncbuf[0] << 16) & 0x00FF0000) | ((syncbuf[1] << 8) & 0x0000FF00) | ((syncbuf[2] << 0) & 0x000000FF);
do
{
headerstring <<= 8;
if (readBytes(syncbuf, 3, 1)!=1)
throw newBitstreamException(STREAM_EOF, null);
headerstring |= (syncbuf[3] & 0x000000FF);
sync = isSyncMark(headerstring, syncmode, syncword);
}
while (!sync);
//current_frame_number++;
//if (last_frame_number < current_frame_number) last_frame_number = current_frame_number;
return headerstring;
}
代码示例来源:origin: com.badlogicgames.jlayer/jlayer
/**
* Reads and parses the next frame from the input source.
* @return the Header describing details of the frame read, or null if the end of the stream has been reached.
*/
public Header readFrame () throws BitstreamException {
Header result = null;
try {
result = readNextFrame();
// E.B, Parse VBR (if any) first frame.
if (firstframe == true) {
result.parseVBR(frame_bytes);
firstframe = false;
}
} catch (BitstreamException ex) {
if (ex.getErrorCode() == INVALIDFRAME)
// Try to skip this frame.
// System.out.println("INVALIDFRAME");
try {
closeFrame();
result = readNextFrame();
} catch (BitstreamException e) {
if (e.getErrorCode() != STREAM_EOF) // wrap original exception so stack trace is maintained.
throw newBitstreamException(e.getErrorCode(), e);
}
else if (ex.getErrorCode() != STREAM_EOF) // wrap original exception so stack trace is maintained.
throw newBitstreamException(ex.getErrorCode(), ex);
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!