public class MP3ElementaryInputStream
extends java.io.FilterInputStream
An MP3 frame has a 32-bit header with the following contents in big endian order:
Reference:
http://en.wikipedia.org/wiki/MP3
http://www.datavoyage.com/mpgscript/mpeghdr.htm
http://www.mp3-tech.org/programmer/frame_header.html
http://lame.sourceforge.net/tech-FAQ.txt
http://www.altera.com/literature/dc/1.4-2005_Taiwan_2nd_SouthernTaiwanU-web.pdf
Modifier and Type | Class and Description |
---|---|
static class |
MP3ElementaryInputStream.Frame
An elementary frame.
|
Modifier and Type | Field and Description |
---|---|
static javax.sound.sampled.AudioFormat.Encoding |
MP3
Defines the "MP3" encoding.
|
Constructor and Description |
---|
MP3ElementaryInputStream(java.io.File file) |
MP3ElementaryInputStream(java.io.InputStream in) |
Modifier and Type | Method and Description |
---|---|
javax.sound.sampled.AudioFormat |
getFormat()
Gets the format of the current frame.
|
MP3ElementaryInputStream.Frame |
getFrame()
Returns the current frame.
|
MP3ElementaryInputStream.Frame |
getNextFrame()
Gets the next frame from the input stream.
|
long |
getStreamPosition()
Returns the current position in the stream.
|
int |
read()
Reads a byte from the current frame (its header and its data).
|
int |
read(byte[] b,
int off,
int len)
Reads up to
len bytes from the current frame (its header and its data). |
void |
readFully(byte[] b)
Reads
b.length bytes from the current frame (its header and its data). |
void |
readFully(byte[] b,
int off,
int len)
Reads
len bytes from the current frame (its header and its data). |
long |
skip(long n)
Skips up to
n bytes from the current frame (its header and its data). |
public static final javax.sound.sampled.AudioFormat.Encoding MP3
public MP3ElementaryInputStream(java.io.File file) throws java.io.IOException
java.io.IOException
public MP3ElementaryInputStream(java.io.InputStream in)
public MP3ElementaryInputStream.Frame getNextFrame() throws java.io.IOException
java.io.IOException
public MP3ElementaryInputStream.Frame getFrame()
public javax.sound.sampled.AudioFormat getFormat()
public int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
len
bytes from the current frame (its header and its data).
May read less then len
bytes. Returns the actual number of bytes read.
Returns -1 on an attempt to read past the end of the frame.read
in class java.io.FilterInputStream
java.io.IOException
public final void readFully(byte[] b) throws java.io.IOException
b.length
bytes from the current frame (its header and its data).{@code
- IOException} on an attempt to read past the end of the frame.java.io.IOException
public final void readFully(byte[] b, int off, int len) throws java.io.IOException
len
bytes from the current frame (its header and its data).{@code
- IOException} on an attempt to read past the end of the frame.java.io.IOException
public long skip(long n) throws java.io.IOException
n
bytes from the current frame (its header and its data).
Returns the actual number of bytes that have been skipped.
Returns -1 on an attempt to skip past the end of the frame.skip
in class java.io.FilterInputStream
java.io.IOException
public long getStreamPosition()