public class Mp3File extends FileWrapper
| Modifier and Type | Field and Description |
|---|---|
private double |
bitrate |
private Map<Integer,MutableInteger> |
bitrates |
protected int |
bufferLength |
private String |
channelMode |
private boolean |
copyright |
private byte[] |
customTag |
private static int |
DEFAULT_BUFFER_LENGTH |
private String |
emphasis |
private int |
endOffset |
private int |
frameCount |
private ID3v1 |
id3v1Tag |
private ID3v2 |
id3v2Tag |
private String |
layer |
private static int |
MINIMUM_BUFFER_LENGTH |
private String |
modeExtension |
private boolean |
original |
private int |
sampleRate |
private boolean |
scanFile |
private int |
startOffset |
private String |
version |
private static int |
XING_MARKER_OFFSET_1 |
private static int |
XING_MARKER_OFFSET_2 |
private static int |
XING_MARKER_OFFSET_3 |
private int |
xingBitrate |
private int |
xingOffset |
lastModified, length, path| Modifier | Constructor and Description |
|---|---|
protected |
Mp3File() |
|
Mp3File(File file) |
|
Mp3File(File file,
int bufferLength) |
|
Mp3File(File file,
int bufferLength,
boolean scanFile) |
|
Mp3File(Path path) |
|
Mp3File(Path path,
int bufferLength) |
|
Mp3File(Path path,
int bufferLength,
boolean scanFile) |
|
Mp3File(String filename) |
|
Mp3File(String filename,
boolean scanFile) |
|
Mp3File(String filename,
int bufferLength) |
|
Mp3File(String filename,
int bufferLength,
boolean scanFile) |
| Modifier and Type | Method and Description |
|---|---|
private void |
addBitrate(int bitrate) |
int |
getBitrate() |
Map<Integer,MutableInteger> |
getBitrates() |
String |
getChannelMode() |
byte[] |
getCustomTag() |
String |
getEmphasis() |
int |
getEndOffset() |
int |
getFrameCount() |
ID3v1 |
getId3v1Tag() |
ID3v2 |
getId3v2Tag() |
String |
getLayer() |
long |
getLengthInMilliseconds() |
long |
getLengthInSeconds() |
String |
getModeExtension() |
int |
getSampleRate() |
int |
getStartOffset() |
String |
getVersion() |
int |
getXingBitrate() |
int |
getXingOffset() |
boolean |
hasCustomTag() |
boolean |
hasId3v1Tag() |
boolean |
hasId3v2Tag() |
boolean |
hasXingFrame() |
private void |
init(int bufferLength,
boolean scanFile) |
private void |
initCustomTag(SeekableByteChannel seekableByteChannel) |
private void |
initId3v1Tag(SeekableByteChannel seekableByteChannel) |
private void |
initId3v2Tag(SeekableByteChannel seekableByteChannel) |
boolean |
isCopyright() |
boolean |
isOriginal() |
boolean |
isVbr() |
private boolean |
isXingFrame(byte[] bytes,
int offset) |
private int |
maxEndOffset() |
protected int |
preScanFile(SeekableByteChannel seekableByteChannel) |
void |
removeCustomTag() |
void |
removeId3v1Tag() |
void |
removeId3v2Tag() |
private void |
sanityCheckFrame(MpegFrame frame,
int offset) |
void |
save(String newFilename) |
private void |
saveMpegFrames(SeekableByteChannel saveFile) |
private int |
scanBlock(byte[] bytes,
int bytesRead,
int absoluteOffset,
int offset) |
private int |
scanBlockForStart(byte[] bytes,
int bytesRead,
int absoluteOffset,
int offset) |
private void |
scanFile(SeekableByteChannel seekableByteChannel) |
void |
setCustomTag(byte[] customTag) |
void |
setId3v1Tag(ID3v1 id3v1Tag) |
void |
setId3v2Tag(ID3v2 id3v2Tag) |
getFilename, getLastModified, getLengthprivate static final int DEFAULT_BUFFER_LENGTH
private static final int MINIMUM_BUFFER_LENGTH
private static final int XING_MARKER_OFFSET_1
private static final int XING_MARKER_OFFSET_2
private static final int XING_MARKER_OFFSET_3
protected int bufferLength
private int xingOffset
private int startOffset
private int endOffset
private int frameCount
private Map<Integer,MutableInteger> bitrates
private int xingBitrate
private double bitrate
private String channelMode
private String emphasis
private String layer
private String modeExtension
private int sampleRate
private boolean copyright
private boolean original
private String version
private ID3v1 id3v1Tag
private ID3v2 id3v2Tag
private byte[] customTag
private boolean scanFile
protected Mp3File()
public Mp3File(String filename) throws IOException, UnsupportedTagException, InvalidDataException
public Mp3File(String filename, int bufferLength) throws IOException, UnsupportedTagException, InvalidDataException
public Mp3File(String filename, boolean scanFile) throws IOException, UnsupportedTagException, InvalidDataException
public Mp3File(String filename, int bufferLength, boolean scanFile) throws IOException, UnsupportedTagException, InvalidDataException
public Mp3File(File file) throws IOException, UnsupportedTagException, InvalidDataException
public Mp3File(File file, int bufferLength) throws IOException, UnsupportedTagException, InvalidDataException
public Mp3File(File file, int bufferLength, boolean scanFile) throws IOException, UnsupportedTagException, InvalidDataException
public Mp3File(Path path) throws IOException, UnsupportedTagException, InvalidDataException
public Mp3File(Path path, int bufferLength) throws IOException, UnsupportedTagException, InvalidDataException
public Mp3File(Path path, int bufferLength, boolean scanFile) throws IOException, UnsupportedTagException, InvalidDataException
private void init(int bufferLength,
boolean scanFile)
throws IOException,
UnsupportedTagException,
InvalidDataException
protected int preScanFile(SeekableByteChannel seekableByteChannel)
private void scanFile(SeekableByteChannel seekableByteChannel) throws IOException, InvalidDataException
IOExceptionInvalidDataExceptionprivate int scanBlockForStart(byte[] bytes,
int bytesRead,
int absoluteOffset,
int offset)
private int scanBlock(byte[] bytes,
int bytesRead,
int absoluteOffset,
int offset)
throws InvalidDataException
InvalidDataExceptionprivate int maxEndOffset()
private boolean isXingFrame(byte[] bytes,
int offset)
private void sanityCheckFrame(MpegFrame frame, int offset) throws InvalidDataException
InvalidDataExceptionprivate void addBitrate(int bitrate)
private void initId3v1Tag(SeekableByteChannel seekableByteChannel) throws IOException
IOExceptionprivate void initId3v2Tag(SeekableByteChannel seekableByteChannel) throws IOException, UnsupportedTagException, InvalidDataException
private void initCustomTag(SeekableByteChannel seekableByteChannel) throws IOException
IOExceptionpublic int getFrameCount()
public int getStartOffset()
public int getEndOffset()
public long getLengthInMilliseconds()
public long getLengthInSeconds()
public boolean isVbr()
public int getBitrate()
public Map<Integer,MutableInteger> getBitrates()
public String getChannelMode()
public boolean isCopyright()
public String getEmphasis()
public String getLayer()
public String getModeExtension()
public boolean isOriginal()
public int getSampleRate()
public String getVersion()
public boolean hasXingFrame()
public int getXingOffset()
public int getXingBitrate()
public boolean hasId3v1Tag()
public ID3v1 getId3v1Tag()
public void setId3v1Tag(ID3v1 id3v1Tag)
public void removeId3v1Tag()
public boolean hasId3v2Tag()
public ID3v2 getId3v2Tag()
public void setId3v2Tag(ID3v2 id3v2Tag)
public void removeId3v2Tag()
public boolean hasCustomTag()
public byte[] getCustomTag()
public void setCustomTag(byte[] customTag)
public void removeCustomTag()
public void save(String newFilename) throws IOException, NotSupportedException
IOExceptionNotSupportedExceptionprivate void saveMpegFrames(SeekableByteChannel saveFile) throws IOException
IOException