|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object entagged.audioformats.mp3.util.id3frames.Id3Frame
public abstract class Id3Frame
This class represents an ID3-Frame and provides basic information.
Field Summary | |
---|---|
protected byte[] |
flags
The frame header flags are stored here. The flags have always been 2 bytes long. |
protected byte |
version
ID3 version identifier. |
Constructor Summary | |
---|---|
Id3Frame()
Creates a new frame instance. Id3 version assigned is 2.4. |
|
Id3Frame(byte[] raw,
byte id3Version)
Creates a frame instance which adjusts to the given raw -data. |
Method Summary | |
---|---|
protected abstract byte[] |
build()
This method creates a binary representation of the current Id3Frame data.This data can directly be written to a file or stream. s |
Object |
clone()
(overridden) |
protected void |
copy(byte[] src,
byte[] dst,
int dstOffset)
|
boolean |
equals(Object obj)
(overridden) For Id3Frame objects the comparison can be easily done by comparing their binary representation which can be retrieved by invoking build() . |
protected byte[] |
getBytes(String s,
String encoding)
Convenience method converting a string to a binary representation according to the given encoding. |
byte[] |
getFlags()
Returns the flags of the frame. |
abstract String |
getId()
(overridden) For Id3-Frames its something like "TCOM","TENC","TALB" and so on. |
protected byte[] |
getIdBytes()
Convenience method for getting the binary representation of getId() . |
byte[] |
getRawContent()
(overridden) simply calls build() directly. |
protected byte[] |
getSize(int size)
Converts the given value of size into a representation
which can be used to write a frames size into a file (or stream).For now there are two different kinds of binary representation of a size value in ID3 frames. First the prior 2.4 variation which is a simple "litte endian". Second the 2.4 variation which utilizes Id3v2TagCreator.getSyncSafe(int) . |
protected String |
getString(byte[] b,
int offset,
int length,
String encoding)
Another convenience Method which parses a byte array and returns a String instance. |
protected int |
indexOfFirstNull(byte[] b,
int offset)
Convenience method which searches for the next zero byte in an array. |
abstract boolean |
isBinary()
(overridden) |
void |
isBinary(boolean b)
(overridden) |
abstract boolean |
isCommon()
(overridden) |
protected abstract void |
populate(byte[] raw)
This method reads the given data of an ID3-Frame and interprets it implementation specific. The values of the Id3Frame instance are adjusted. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface entagged.audioformats.generic.TagField |
---|
copyContent, isEmpty, toString |
Field Detail |
---|
protected byte[] flags
protected byte version
Id3v2Tag.ID3V22
,
Id3v2Tag.ID3V23
,
Id3v2Tag.ID3V24
Constructor Detail |
---|
public Id3Frame()
public Id3Frame(byte[] raw, byte id3Version) throws UnsupportedEncodingException
raw
-data.
raw
- The data of the frame.id3Version
- The ID3-Tag version.
UnsupportedEncodingException
- If a textframe's content cannot be interpreted.Method Detail |
---|
protected abstract byte[] build() throws UnsupportedEncodingException
Id3Frame
data.
UnsupportedEncodingException
- If a text-Frame is constructed there can occur an error
during text conversions.public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
Object.clone()
protected void copy(byte[] src, byte[] dst, int dstOffset)
public boolean equals(Object obj)
build()
.
equals
in class Object
Object.equals(java.lang.Object)
protected byte[] getBytes(String s, String encoding) throws UnsupportedEncodingException
s
- The string to get the binary representation from.encoding
- The encoding which should be used.
UnsupportedEncodingException
- If the string needs to be converted and the encoding is not
present.public byte[] getFlags()
public abstract String getId()
getId
in interface TagField
TagField.getId()
protected byte[] getIdBytes()
getId()
.
getId()
.String.getBytes()
public byte[] getRawContent() throws UnsupportedEncodingException
build()
directly.
getRawContent
in interface TagField
UnsupportedEncodingException
- Most tag data represents text. In some cases the underlying
implementation will need to convert the text data in java to
a specific charset encoding. In these cases an
UnsupportedEncodingException
may occur.TagField.getRawContent()
protected byte[] getSize(int size)
size
into a representation
which can be used to write a frames size into a file (or stream).Id3v2TagCreator.getSyncSafe(int)
.
size
- The integer value to convert.
protected String getString(byte[] b, int offset, int length, String encoding) throws UnsupportedEncodingException
String
instance.
b
- The array where the string resides.offset
- The offset in b
where the string begins.length
- The length in bytes which makes up the string.encoding
- The encoding of the string in b
.
UnsupportedEncodingException
- If an conversion error occurs or the encoding is not
available on the running system.protected int indexOfFirstNull(byte[] b, int offset)
b
- The array to search in.offset
- The offset of b from where to look for the next zero
byte.
b
if found. If none
was found, "-1
" is returned.public abstract boolean isBinary()
isBinary
in interface TagField
true
if field represents binary data (not human
readable).TagField.isBinary()
public void isBinary(boolean b)
isBinary
in interface TagField
b
- true
, if the field contains binary data.TagField.isBinary(boolean)
public abstract boolean isCommon()
isCommon
in interface TagField
true
if the field is of common use.TagField.isCommon()
protected abstract void populate(byte[] raw) throws UnsupportedEncodingException
raw
- The frame data.
UnsupportedEncodingException
- On text frames there can be such errors.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |