code
stringlengths 11
173k
| docstring
stringlengths 2
593k
| func_name
stringlengths 2
189
| language
stringclasses 1
value | repo
stringclasses 844
values | path
stringlengths 11
294
| url
stringlengths 60
339
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
public Object getValue()
{
if (value != null)
{
return ID3Tags.stripChar(value.toString(), '-');
}
else
{
return null;
}
} |
@return
| StringDate::getValue | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/StringDate.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/StringDate.java | Apache-2.0 |
public PartOfSet(String identifier, AbstractTagFrameBody frameBody)
{
super(identifier, frameBody);
} |
Creates a new empty PartOfSet datatype.
@param identifier identifies the frame type
@param frameBody
| PartOfSet::PartOfSet | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | Apache-2.0 |
public PartOfSet(PartOfSet object)
{
super(object);
} |
Copy constructor
@param object
| PartOfSet::PartOfSet | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | Apache-2.0 |
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException
{
logger.finest("Reading from array from offset:" + offset);
//Get the Specified Decoder
CharsetDecoder decoder = getTextEncodingCharSet().newDecoder();
//Decode sliced inBuffer
ByteBuffer inBuffer = ByteBuffer.wrap(arr, offset, arr.length - offset).slice();
CharBuffer outBuffer = CharBuffer.allocate(arr.length - offset);
decoder.reset();
CoderResult coderResult = decoder.decode(inBuffer, outBuffer, true);
if (coderResult.isError())
{
logger.warning("Decoding error:" + coderResult);
}
decoder.flush(outBuffer);
outBuffer.flip();
//Store value
String stringValue = outBuffer.toString();
value = new PartOfSetValue(stringValue);
//SetSize, important this is correct for finding the next datatype
setSize(arr.length - offset);
logger.config("Read SizeTerminatedString:" + value + " size:" + size);
} |
Read a 'n' bytes from buffer into a String where n is the frameSize - offset
so therefore cannot use this if there are other objects after it because it has no
delimiter.
Must take into account the text encoding defined in the Encoding Object
ID3 Text Frames often allow multiple strings separated by the null char
appropriate for the encoding.
@param arr this is the buffer for the frame
@param offset this is where to start reading in the buffer for this field
@throws NullPointerException
@throws IndexOutOfBoundsException
| PartOfSet::readByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | Apache-2.0 |
public byte[] writeByteArray()
{
String value = getValue().toString();
byte[] data;
//Try and write to buffer using the CharSet defined by getTextEncodingCharSet()
try
{
if (TagOptionSingleton.getInstance().isRemoveTrailingTerminatorOnWrite())
{
if (value.length() > 0)
{
if (value.charAt(value.length() - 1) == '\0')
{
value = value.substring(0, value.length() - 1);
}
}
}
final Charset charset = getTextEncodingCharSet();
final String valueWithBOM;
final CharsetEncoder encoder;
if (StandardCharsets.UTF_16.equals(charset))
{
encoder = StandardCharsets.UTF_16LE.newEncoder();
//Note remember LE BOM is ff fe but this is handled by encoder Unicode char is fe ff
valueWithBOM = '\ufeff' + value;
}
else
{
encoder = charset.newEncoder();
valueWithBOM = value;
}
encoder.onMalformedInput(CodingErrorAction.IGNORE);
encoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
final ByteBuffer bb = encoder.encode(CharBuffer.wrap(valueWithBOM));
data = new byte[bb.limit()];
bb.get(data, 0, bb.limit());
}
//Should never happen so if does throw a RuntimeException
catch (CharacterCodingException ce)
{
logger.severe(ce.getMessage());
throw new RuntimeException(ce);
}
setSize(data.length);
return data;
} |
Write String into byte array
It will remove a trailing null terminator if exists if the option
RemoveTrailingTerminatorOnWrite has been set.
@return the data as a byte array in format to write to file
| PartOfSet::writeByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | Apache-2.0 |
protected Charset getTextEncodingCharSet()
{
final byte textEncoding = this.getBody().getTextEncoding();
final Charset charset = TextEncoding.getInstanceOf().getCharsetForId(textEncoding);
logger.finest("text encoding:" + textEncoding + " charset:" + charset.name());
return charset;
} |
Get the text encoding being used.
The text encoding is defined by the frame body that the text field belongs to.
@return the text encoding charset
| PartOfSet::getTextEncodingCharSet | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | Apache-2.0 |
public PartOfSetValue(String value)
{
this.rawText = value;
initFromValue(value);
} |
When constructing from data
@param value
| PartOfSetValue::PartOfSetValue | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | Apache-2.0 |
public PartOfSetValue(Integer count, Integer total)
{
this.count = count;
this.rawCount = count.toString();
this.total = total;
this.rawTotal = total.toString();
resetValueFromCounts();
} |
Newly created
@param count
@param total
| PartOfSetValue::PartOfSetValue | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | Apache-2.0 |
private void initFromValue(String value)
{
try
{
Matcher m = trackNoPatternWithTotalCount.matcher(value);
if (m.matches())
{
this.extra = m.group(3);
this.count = Integer.parseInt(m.group(1));
this.rawCount=m.group(1);
this.total = Integer.parseInt(m.group(2));
this.rawTotal=m.group(2);
return;
}
m = trackNoPattern.matcher(value);
if (m.matches())
{
this.extra = m.group(2);
this.count = Integer.parseInt(m.group(1));
this.rawCount = m.group(1);
}
}
catch (NumberFormatException nfe)
{
//#JAUDIOTAGGER-366 Could occur if actually value is a long not an int
this.count = 0;
}
} |
Given a raw value that could contain both a count and total and extra stuff (but needdnt contain
anything tries to parse it)
@param value
| PartOfSetValue::initFromValue | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | Apache-2.0 |
public String getCountAsText()
{
//Don't Pad
StringBuffer sb = new StringBuffer();
if (!TagOptionSingleton.getInstance().isPadNumbers())
{
return rawCount;
}
else
{
padNumber(sb, count, TagOptionSingleton.getInstance().getPadNumberTotalLength());
}
return sb.toString();
} |
Get Count including padded if padding is enabled
@return
| PartOfSetValue::getCountAsText | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | Apache-2.0 |
private void padNumber(StringBuffer sb, Integer count,PadNumberOption padNumberLength)
{
if (count != null)
{
if(padNumberLength==PadNumberOption.PAD_ONE_ZERO)
{
if (count > 0 && count < 10)
{
sb.append("0").append(count);
}
else
{
sb.append(count.intValue());
}
}
else if(padNumberLength==PadNumberOption.PAD_TWO_ZERO)
{
if (count > 0 && count < 10)
{
sb.append("00").append(count);
}
else if (count > 9 && count < 100)
{
sb.append("0").append(count);
}
else
{
sb.append(count.intValue());
}
}
else if(padNumberLength==PadNumberOption.PAD_THREE_ZERO)
{
if (count > 0 && count < 10)
{
sb.append("000").append(count);
}
else if (count > 9 && count < 100)
{
sb.append("00").append(count);
}
else if (count > 99 && count < 1000)
{
sb.append("0").append(count);
}
else
{
sb.append(count.intValue());
}
}
}
} |
Pad number so number is defined as long as length
@param sb
@param count
@param padNumberLength
| PartOfSetValue::padNumber | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | Apache-2.0 |
public String getTotalAsText()
{
//Don't Pad
StringBuffer sb = new StringBuffer();
if (!TagOptionSingleton.getInstance().isPadNumbers())
{
return rawTotal;
}
else
{
padNumber(sb, total, TagOptionSingleton.getInstance().getPadNumberTotalLength());
}
return sb.toString();
} |
Get Total padded
@return
| PartOfSetValue::getTotalAsText | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/PartOfSet.java | Apache-2.0 |
public Lyrics3Line(String identifier, AbstractTagFrameBody frameBody)
{
super(identifier, frameBody);
} |
Creates a new ObjectLyrics3Line datatype.
@param identifier
@param frameBody
| Lyrics3Line::Lyrics3Line | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | Apache-2.0 |
public String getLyric()
{
return lyric;
} |
@return
| Lyrics3Line::getLyric | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | Apache-2.0 |
public int getSize()
{
int size = 0;
for (Object aTimeStamp : timeStamp)
{
size += ((Lyrics3TimeStamp) aTimeStamp).getSize();
}
return size + lyric.length();
} |
@return
| Lyrics3Line::getSize | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | Apache-2.0 |
public void setTimeStamp(Lyrics3TimeStamp time)
{
timeStamp.clear();
timeStamp.add(time);
} |
@param time
| Lyrics3Line::setTimeStamp | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | Apache-2.0 |
public Iterator<Lyrics3TimeStamp> getTimeStamp()
{
return timeStamp.iterator();
} |
@return
| Lyrics3Line::getTimeStamp | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | Apache-2.0 |
public void addTimeStamp(Lyrics3TimeStamp time)
{
timeStamp.add(time);
} |
@param time
| Lyrics3Line::addTimeStamp | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | Apache-2.0 |
public boolean equals(Object obj)
{
if (!(obj instanceof Lyrics3Line object))
{
return false;
}
if (!this.lyric.equals(object.lyric))
{
return false;
}
return this.timeStamp.equals(object.timeStamp) && super.equals(obj);
} |
@param obj
@return
| Lyrics3Line::equals | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | Apache-2.0 |
public boolean hasTimeStamp()
{
return !timeStamp.isEmpty();
} |
@return
| Lyrics3Line::hasTimeStamp | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | Apache-2.0 |
public void readString(String lineString, int offset)
{
if (lineString == null)
{
throw new NullPointerException("Image is null");
}
if ((offset < 0) || (offset >= lineString.length()))
{
throw new IndexOutOfBoundsException("Offset to line is out of bounds: offset = " + offset + ", line.length()" + lineString.length());
}
int delim;
Lyrics3TimeStamp time;
timeStamp = new LinkedList<Lyrics3TimeStamp>();
delim = lineString.indexOf("[", offset);
while (delim >= 0)
{
offset = lineString.indexOf("]", delim) + 1;
time = new Lyrics3TimeStamp("Time Stamp");
time.readString(lineString.substring(delim, offset));
timeStamp.add(time);
delim = lineString.indexOf("[", offset);
}
lyric = lineString.substring(offset);
} |
@param lineString
@param offset
@throws NullPointerException
@throws IndexOutOfBoundsException
| Lyrics3Line::readString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | Apache-2.0 |
public String toString()
{
String str = "";
for (Object aTimeStamp : timeStamp)
{
str += aTimeStamp.toString();
}
return "timeStamp = " + str + ", lyric = " + lyric + "\n";
} |
@return
| Lyrics3Line::toString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | Apache-2.0 |
public String writeString()
{
String str = "";
Lyrics3TimeStamp time;
for (Object aTimeStamp : timeStamp)
{
time = (Lyrics3TimeStamp) aTimeStamp;
str += time.writeString();
}
return str + lyric;
} |
@return
| Lyrics3Line::writeString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Line.java | Apache-2.0 |
public void readString(String s)
{
} |
Todo this is wrong
@param s
| Lyrics3TimeStamp::readString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | Apache-2.0 |
public Lyrics3TimeStamp(String identifier, AbstractTagFrameBody frameBody)
{
super(identifier, frameBody);
} |
Creates a new ObjectLyrics3TimeStamp datatype.
@param identifier
@param frameBody
| Lyrics3TimeStamp::Lyrics3TimeStamp | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | Apache-2.0 |
public long getMinute()
{
return minute;
} |
@return
| Lyrics3TimeStamp::getMinute | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | Apache-2.0 |
public long getSecond()
{
return second;
} |
@return
| Lyrics3TimeStamp::getSecond | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | Apache-2.0 |
public int getSize()
{
return 7;
} |
@return
| Lyrics3TimeStamp::getSize | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | Apache-2.0 |
public void setTimeStamp(long timeStamp, byte timeStampFormat)
{
/**
* @todo convert both types of formats
*/
timeStamp = timeStamp / 1000;
minute = timeStamp / 60;
second = timeStamp % 60;
} |
Creates a new ObjectLyrics3TimeStamp datatype.
@param timeStamp
@param timeStampFormat
| Lyrics3TimeStamp::setTimeStamp | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | Apache-2.0 |
public boolean equals(Object obj)
{
if (!(obj instanceof Lyrics3TimeStamp object))
{
return false;
}
if (this.minute != object.minute)
{
return false;
}
return this.second == object.second && super.equals(obj);
} |
@param obj
@return
| Lyrics3TimeStamp::equals | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | Apache-2.0 |
public void readString(String timeStamp, int offset)
{
if (timeStamp == null)
{
throw new NullPointerException("Image is null");
}
if ((offset < 0) || (offset >= timeStamp.length()))
{
throw new IndexOutOfBoundsException("Offset to timeStamp is out of bounds: offset = " + offset + ", timeStamp.length()" + timeStamp.length());
}
timeStamp = timeStamp.substring(offset);
if (timeStamp.length() == 7)
{
minute = Integer.parseInt(timeStamp.substring(1, 3));
second = Integer.parseInt(timeStamp.substring(4, 6));
}
else
{
minute = 0;
second = 0;
}
} |
@param timeStamp
@param offset
@throws NullPointerException
@throws IndexOutOfBoundsException
| Lyrics3TimeStamp::readString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | Apache-2.0 |
public String toString()
{
return writeString();
} |
@return
| Lyrics3TimeStamp::toString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | Apache-2.0 |
public String writeString()
{
String str;
str = "[";
if (minute < 0)
{
str += "00";
}
else
{
if (minute < 10)
{
str += '0';
}
str += Long.toString(minute);
}
str += ':';
if (second < 0)
{
str += "00";
}
else
{
if (second < 10)
{
str += '0';
}
str += Long.toString(second);
}
str += ']';
return str;
} |
@return
| Lyrics3TimeStamp::writeString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3TimeStamp.java | Apache-2.0 |
public BooleanByte(String identifier, AbstractTagFrameBody frameBody, int bitPosition)
{
super(identifier, frameBody);
if ((bitPosition < 0) || (bitPosition > 7))
{
throw new IndexOutOfBoundsException("Bit position needs to be from 0 - 7 : " + bitPosition);
}
this.bitPosition = bitPosition;
} |
Creates a new ObjectBooleanByte datatype.
@param identifier
@param frameBody
@param bitPosition
@throws IndexOutOfBoundsException
| BooleanByte::BooleanByte | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/BooleanByte.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/BooleanByte.java | Apache-2.0 |
public int getBitPosition()
{
return bitPosition;
} |
@return
| BooleanByte::getBitPosition | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/BooleanByte.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/BooleanByte.java | Apache-2.0 |
public int getSize()
{
return 1;
} |
@return
| BooleanByte::getSize | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/BooleanByte.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/BooleanByte.java | Apache-2.0 |
public boolean equals(Object obj)
{
if (!(obj instanceof BooleanByte object))
{
return false;
}
return this.bitPosition == object.bitPosition && super.equals(obj);
} |
@param obj
@return
| BooleanByte::equals | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/BooleanByte.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/BooleanByte.java | Apache-2.0 |
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException
{
if (arr == null)
{
throw new NullPointerException("Byte array is null");
}
if ((offset < 0) || (offset >= arr.length))
{
throw new IndexOutOfBoundsException("Offset to byte array is out of bounds: offset = " + offset + ", array.length = " + arr.length);
}
byte newValue = arr[offset];
newValue >>= bitPosition;
newValue &= 0x1;
this.value = newValue == 1;
} |
@param arr
@param offset
@throws NullPointerException
@throws IndexOutOfBoundsException
| BooleanByte::readByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/BooleanByte.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/BooleanByte.java | Apache-2.0 |
public String toString()
{
return "" + value;
} |
@return
| BooleanByte::toString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/BooleanByte.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/BooleanByte.java | Apache-2.0 |
public byte[] writeByteArray()
{
byte[] retValue;
retValue = new byte[1];
if (value != null)
{
retValue[0] = (byte) ((Boolean) value ? 1 : 0);
retValue[0] <<= bitPosition;
}
return retValue;
} |
@return
| BooleanByte::writeByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/BooleanByte.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/BooleanByte.java | Apache-2.0 |
public TextEncodedStringSizeTerminated(String identifier, AbstractTagFrameBody frameBody)
{
super(identifier, frameBody);
} |
Creates a new empty TextEncodedStringSizeTerminated datatype.
@param identifier identifies the frame type
@param frameBody
| TextEncodedStringSizeTerminated::TextEncodedStringSizeTerminated | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | Apache-2.0 |
public TextEncodedStringSizeTerminated(TextEncodedStringSizeTerminated object)
{
super(object);
} |
Copy constructor
@param object
| TextEncodedStringSizeTerminated::TextEncodedStringSizeTerminated | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | Apache-2.0 |
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException
{
logger.finest("Reading from array from offset:" + offset);
//Decode sliced inBuffer
ByteBuffer inBuffer;
if(TagOptionSingleton.getInstance().isAndroid())
{
//#302 [dallen] truncating array manually since the decoder.decode() does not honor the offset in the in buffer
byte[] truncArr = new byte[arr.length - offset];
System.arraycopy(arr, offset, truncArr, 0, truncArr.length);
inBuffer = ByteBuffer.wrap(truncArr);
}
else
{
inBuffer = ByteBuffer.wrap(arr, offset, arr.length - offset).slice();
}
CharBuffer outBuffer = CharBuffer.allocate(arr.length - offset);
CharsetDecoder decoder = getCorrectDecoder(inBuffer);
CoderResult coderResult = decoder.decode(inBuffer, outBuffer, true);
if (coderResult.isError())
{
logger.warning("Decoding error:" + coderResult);
}
decoder.flush(outBuffer);
outBuffer.flip();
//If using UTF16 with BOM we then search through the text removing any BOMs that could exist
//for multiple values, BOM could be Big Endian or Little Endian
if (StandardCharsets.UTF_16.equals(getTextEncodingCharSet()))
{
value = outBuffer.toString().replace("\ufeff","").replace("\ufffe","");
}
else
{
value = outBuffer.toString();
}
//SetSize, important this is correct for finding the next datatype
setSize(arr.length - offset);
logger.finest("Read SizeTerminatedString:" + value + " size:" + size);
} |
Read a 'n' bytes from buffer into a String where n is the framesize - offset
so therefore cannot use this if there are other objects after it because it has no
delimiter.
Must take into account the text encoding defined in the Encoding Object
ID3 Text Frames often allow multiple strings seperated by the null char
appropriate for the encoding.
@param arr this is the buffer for the frame
@param offset this is where to start reading in the buffer for this field
@throws NullPointerException
@throws IndexOutOfBoundsException
| TextEncodedStringSizeTerminated::readByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | Apache-2.0 |
protected ByteBuffer writeString( CharsetEncoder encoder, String next, int i, int noOfValues)
throws CharacterCodingException
{
ByteBuffer bb;
if(( i + 1) == noOfValues )
{
bb = encoder.encode(CharBuffer.wrap(next));
}
else
{
bb = encoder.encode(CharBuffer.wrap(next + '\0'));
}
bb.rewind();
return bb;
} |
Write String using specified encoding
When this is called multiple times, all but the last value has a trailing null
@param encoder
@param next
@param i
@param noOfValues
@return
@throws CharacterCodingException
| TextEncodedStringSizeTerminated::writeString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | Apache-2.0 |
protected ByteBuffer writeStringUTF16LEBOM(final String next, final int i, final int noOfValues)
throws CharacterCodingException
{
final CharsetEncoder encoder = StandardCharsets.UTF_16LE.newEncoder();
encoder.onMalformedInput(CodingErrorAction.IGNORE);
encoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
ByteBuffer bb;
//Note remember LE BOM is ff fe but this is handled by encoder Unicode char is fe ff
if(( i + 1)==noOfValues)
{
bb = encoder.encode(CharBuffer.wrap('\ufeff' + next ));
}
else
{
bb = encoder.encode(CharBuffer.wrap('\ufeff' + next + '\0'));
}
bb.rewind();
return bb;
} |
Write String in UTF-LEBOM format
When this is called multiple times, all but the last value has a trailing null
Remember we are using this charset because the charset that writes BOM does it the wrong way for us
so we use this none and then manually add the BOM ourselves.
@param next
@param i
@param noOfValues
@return
@throws CharacterCodingException
| TextEncodedStringSizeTerminated::writeStringUTF16LEBOM | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | Apache-2.0 |
protected ByteBuffer writeStringUTF16BEBOM(final String next, final int i, final int noOfValues)
throws CharacterCodingException
{
final CharsetEncoder encoder = StandardCharsets.UTF_16BE.newEncoder();
encoder.onMalformedInput(CodingErrorAction.IGNORE);
encoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
ByteBuffer bb;
//Add BOM
if(( i + 1)==noOfValues)
{
bb = encoder.encode(CharBuffer.wrap('\ufeff' + next ));
}
else
{
bb = encoder.encode(CharBuffer.wrap('\ufeff' + next + '\0'));
}
bb.rewind();
return bb;
} |
Write String in UTF-BEBOM format
When this is called multiple times, all but the last value has a trailing null
@param next
@param i
@param noOfValues
@return
@throws CharacterCodingException
| TextEncodedStringSizeTerminated::writeStringUTF16BEBOM | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | Apache-2.0 |
protected void stripTrailingNull()
{
if (TagOptionSingleton.getInstance().isRemoveTrailingTerminatorOnWrite())
{
String stringValue = (String) value;
if (stringValue.length() > 0)
{
if (stringValue.charAt(stringValue.length() - 1) == '\0')
{
stringValue = (stringValue).substring(0, stringValue.length() - 1);
value = stringValue;
}
}
}
} |
Removing trailing null from end of String, this should not be there but some applications continue to write
this unnecessary null char.
| TextEncodedStringSizeTerminated::stripTrailingNull | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | Apache-2.0 |
protected void checkTrailingNull( List<String> values, String stringValue)
{
if(!TagOptionSingleton.getInstance().isRemoveTrailingTerminatorOnWrite())
{
if (stringValue.length() > 0 && stringValue.charAt(stringValue.length() - 1) == '\0')
{
String lastVal = values.get(values.size() - 1);
String newLastVal = lastVal + '\0';
values.set(values.size() - 1,newLastVal);
}
}
} |
Because nulls are stripped we need to check if not removing trailing nulls whether the original
value ended with a null and if so add it back in.
@param values
@param stringValue
| TextEncodedStringSizeTerminated::checkTrailingNull | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | Apache-2.0 |
public byte[] writeByteArray()
{
byte[] data;
//Try and write to buffer using the CharSet defined by getTextEncodingCharSet()
final Charset charset = getTextEncodingCharSet();
try
{
stripTrailingNull();
//Special Handling because there is no UTF16 BOM LE charset
String stringValue = (String)value;
Charset actualCharSet = null;
if (StandardCharsets.UTF_16.equals(charset))
{
if (TagOptionSingleton.getInstance().isEncodeUTF16BomAsLittleEndian())
{
actualCharSet = StandardCharsets.UTF_16LE;
}
else
{
actualCharSet = StandardCharsets.UTF_16BE;
}
}
//Ensure large enough for any encoding
ByteBuffer outputBuffer = ByteBuffer.allocate((stringValue.length() + 3)* 3);
//Ensure each string (if multiple values) is written with BOM by writing separately
List<String> values = splitByNullSeperator(stringValue);
checkTrailingNull(values, stringValue);
//For each value
for (int i=0;i<values.size();i++)
{
String next = values.get(i);
if (StandardCharsets.UTF_16LE.equals(actualCharSet))
{
outputBuffer.put(writeStringUTF16LEBOM( next, i, values.size()));
}
else if (StandardCharsets.UTF_16BE.equals(actualCharSet))
{
outputBuffer.put(writeStringUTF16BEBOM( next, i, values.size()));
}
else
{
final CharsetEncoder charsetEncoder = charset.newEncoder();
charsetEncoder.onMalformedInput(CodingErrorAction.IGNORE);
charsetEncoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
outputBuffer.put(writeString(charsetEncoder, next, i, values.size()));
}
}
outputBuffer.flip();
data = new byte[outputBuffer.limit()];
outputBuffer.rewind();
outputBuffer.get(data, 0, outputBuffer.limit());
setSize(data.length);
}
//https://bitbucket.org/ijabz/jaudiotagger/issue/1/encoding-metadata-to-utf-16-can-fail-if
catch (CharacterCodingException ce)
{
logger.severe(ce.getMessage()+":"+charset+":"+value);
throw new RuntimeException(ce);
}
return data;
} |
Write String into byte array
It will remove a trailing null terminator if exists if the option
RemoveTrailingTerminatorOnWrite has been set.
@return the data as a byte array in format to write to file
| TextEncodedStringSizeTerminated::writeByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | Apache-2.0 |
public static List<String> splitByNullSeperator(String value)
{
String[] valuesarray = value.split("\\u0000");
List<String> values = Arrays.asList(valuesarray);
//Read only list so if empty have to create new list
if (values.size() == 0)
{
values = new ArrayList<String>(1);
values.add("");
}
return values;
} |
Split the values separated by null character
@param value the raw value
@return list of values, guaranteed to be at least one value
| TextEncodedStringSizeTerminated::splitByNullSeperator | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | Apache-2.0 |
public void addValue(String value)
{
setValue(this.value + "\u0000" + value);
} |
Add an additional String to the current String value
@param value
| TextEncodedStringSizeTerminated::addValue | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | Apache-2.0 |
public int getNumberOfValues()
{
return splitByNullSeperator(((String) value)).size();
} |
How many values are held, each value is separated by a null terminator
@return number of values held, usually this will be one.
| TextEncodedStringSizeTerminated::getNumberOfValues | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | Apache-2.0 |
public String getValueAtIndex(int index)
{
//Split String into separate components
List values = splitByNullSeperator((String) value);
return (String) values.get(index);
} |
Get the nth value
@param index
@return the nth value
@throws IndexOutOfBoundsException if value does not exist
| TextEncodedStringSizeTerminated::getValueAtIndex | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | Apache-2.0 |
public List<String> getValues()
{
return splitByNullSeperator((String) value);
} |
@return list of all values
| TextEncodedStringSizeTerminated::getValues | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | Apache-2.0 |
public String getValueWithoutTrailingNull()
{
List<String> values = splitByNullSeperator((String) value);
StringBuffer sb = new StringBuffer();
for(int i=0;i<values.size();i++)
{
if(i!=0)
{
sb.append("\u0000");
}
sb.append(values.get(i));
}
return sb.toString();
} |
Get value(s) whilst removing any trailing nulls
@return
| TextEncodedStringSizeTerminated::getValueWithoutTrailingNull | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringSizeTerminated.java | Apache-2.0 |
public NumberFixedLength(String identifier, AbstractTagFrameBody frameBody, int size)
{
super(identifier, frameBody);
if (size < 0)
{
throw new IllegalArgumentException("Length is less than zero: " + size);
}
this.size = size;
} |
Creates a new ObjectNumberFixedLength datatype.
@param identifier
@param frameBody
@param size the number of significant places that the number is held to
@throws IllegalArgumentException
| NumberFixedLength::NumberFixedLength | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/NumberFixedLength.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberFixedLength.java | Apache-2.0 |
public void setSize(int size)
{
if (size > 0)
{
this.size = size;
}
} |
Set Size in Bytes of this Object
@param size in bytes that this number will be held as
| NumberFixedLength::setSize | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/NumberFixedLength.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberFixedLength.java | Apache-2.0 |
public int getSize()
{
return size;
} |
Return size
@return the size of this number
| NumberFixedLength::getSize | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/NumberFixedLength.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberFixedLength.java | Apache-2.0 |
public boolean equals(Object obj)
{
if (!(obj instanceof NumberFixedLength object))
{
return false;
}
return this.size == object.size && super.equals(obj);
} |
@param obj
@return true if obj equivalent to this
| NumberFixedLength::equals | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/NumberFixedLength.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberFixedLength.java | Apache-2.0 |
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException
{
if (arr == null)
{
throw new NullPointerException("Byte array is null");
}
if ((offset < 0) || (offset >= arr.length))
{
throw new InvalidDataTypeException("Offset to byte array is out of bounds: offset = " + offset + ", array.length = " + arr.length);
}
if(offset + size > arr.length)
{
throw new InvalidDataTypeException("Offset plus size to byte array is out of bounds: offset = "
+ offset + ", size = "+size +" + arr.length "+ arr.length );
}
long lvalue = 0;
for (int i = offset; i < (offset + size); i++)
{
lvalue <<= 8;
lvalue += (arr[i] & 0xff);
}
value = lvalue;
logger.config("Read NumberFixedlength:" + value);
} |
Read the number from the byte array
@param arr
@param offset
@throws NullPointerException
@throws IndexOutOfBoundsException
| NumberFixedLength::readByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/NumberFixedLength.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberFixedLength.java | Apache-2.0 |
public String toString()
{
if (value == null)
{
return "";
}
else
{
return value.toString();
}
} |
@return String representation of this datatype
| NumberFixedLength::toString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/NumberFixedLength.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberFixedLength.java | Apache-2.0 |
public byte[] writeByteArray()
{
byte[] arr;
arr = new byte[size];
if (value != null)
{
//Convert value to long
long temp = ID3Tags.getWholeNumber(value);
for (int i = size - 1; i >= 0; i--)
{
arr[i] = (byte) (temp & 0xFF);
temp >>= 8;
}
}
return arr;
} |
Write data to byte array
@return the datatype converted to a byte array
| NumberFixedLength::writeByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/NumberFixedLength.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberFixedLength.java | Apache-2.0 |
public Integer getIdForValue(String value)
{
return valueToId.get(value);
} |
Get Id for Value
@param value
@return
| AbstractIntStringValuePair::getIdForValue | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractIntStringValuePair.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractIntStringValuePair.java | Apache-2.0 |
public String getValueForId(int id)
{
return idToValue.get(id);
} |
Get value for Id
@param id
@return
| AbstractIntStringValuePair::getValueForId | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractIntStringValuePair.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractIntStringValuePair.java | Apache-2.0 |
public int getSize()
{
return text.length() + 1 + 4;
} |
@return
| ID3v2LyricLine::getSize | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/ID3v2LyricLine.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/ID3v2LyricLine.java | Apache-2.0 |
public String getText()
{
return text;
} |
@return
| ID3v2LyricLine::getText | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/ID3v2LyricLine.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/ID3v2LyricLine.java | Apache-2.0 |
public long getTimeStamp()
{
return timeStamp;
} |
@return
| ID3v2LyricLine::getTimeStamp | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/ID3v2LyricLine.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/ID3v2LyricLine.java | Apache-2.0 |
public boolean equals(Object obj)
{
if (!(obj instanceof ID3v2LyricLine object))
{
return false;
}
if (!this.text.equals(object.text))
{
return false;
}
return this.timeStamp == object.timeStamp && super.equals(obj);
} |
@param obj
@return
| ID3v2LyricLine::equals | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/ID3v2LyricLine.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/ID3v2LyricLine.java | Apache-2.0 |
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException
{
if (arr == null)
{
throw new NullPointerException("Byte array is null");
}
if ((offset < 0) || (offset >= arr.length))
{
throw new IndexOutOfBoundsException("Offset to byte array is out of bounds: offset = " + offset + ", array.length = " + arr.length);
}
//offset += ();
text = new String(arr, offset, arr.length - offset - 4, StandardCharsets.ISO_8859_1);
//text = text.substring(0, text.length() - 5);
timeStamp = 0;
for (int i = arr.length - 4; i < arr.length; i++)
{
timeStamp <<= 8;
timeStamp += arr[i];
}
} |
@param arr
@param offset
@throws NullPointerException
@throws IndexOutOfBoundsException
| ID3v2LyricLine::readByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/ID3v2LyricLine.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/ID3v2LyricLine.java | Apache-2.0 |
public String toString()
{
return timeStamp + " " + text;
} |
@return
| ID3v2LyricLine::toString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/ID3v2LyricLine.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/ID3v2LyricLine.java | Apache-2.0 |
public byte[] writeByteArray()
{
int i;
byte[] arr = new byte[getSize()];
for (i = 0; i < text.length(); i++)
{
arr[i] = (byte) text.charAt(i);
}
arr[i++] = 0;
arr[i++] = (byte) ((timeStamp & 0xFF000000) >> 24);
arr[i++] = (byte) ((timeStamp & 0x00FF0000) >> 16);
arr[i++] = (byte) ((timeStamp & 0x0000FF00) >> 8);
arr[i++] = (byte) (timeStamp & 0x000000FF);
return arr;
} |
@return
| ID3v2LyricLine::writeByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/ID3v2LyricLine.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/ID3v2LyricLine.java | Apache-2.0 |
public String getIdForValue(String value)
{
return valueToId.get(value);
} |
Get Id for Value
@param value
@return
| AbstractStringStringValuePair::getIdForValue | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractStringStringValuePair.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractStringStringValuePair.java | Apache-2.0 |
public String getValueForId(String id)
{
return idToValue.get(id);
} |
Get value for Id
@param id
@return
| AbstractStringStringValuePair::getValueForId | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractStringStringValuePair.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractStringStringValuePair.java | Apache-2.0 |
public TextEncodedStringNullTerminated(String identifier, AbstractTagFrameBody frameBody)
{
super(identifier, frameBody);
} |
Creates a new TextEncodedStringNullTerminated datatype.
@param identifier identifies the frame type
@param frameBody
| TextEncodedStringNullTerminated::TextEncodedStringNullTerminated | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringNullTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringNullTerminated.java | Apache-2.0 |
public TextEncodedStringNullTerminated(String identifier, AbstractTagFrameBody frameBody, String value)
{
super(identifier, frameBody, value);
} |
Creates a new TextEncodedStringNullTerminated datatype, with value
@param identifier
@param frameBody
@param value
| TextEncodedStringNullTerminated::TextEncodedStringNullTerminated | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringNullTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringNullTerminated.java | Apache-2.0 |
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException
{
if(offset>=arr.length)
{
throw new InvalidDataTypeException("Unable to find null terminated string");
}
int bufferSize;
logger.finer("Reading from array starting from offset:" + offset);
int size;
//Get the Specified Decoder
final Charset charset = getTextEncodingCharSet();
//We only want to load up to null terminator, data after this is part of different
//field and it may not be possible to decode it so do the check before we do
//do the decoding,encoding dependent.
ByteBuffer buffer = ByteBuffer.wrap(arr, offset, arr.length - offset);
int endPosition = 0;
//Latin-1 and UTF-8 strings are terminated by a single-byte null,
//while UTF-16 and its variants need two bytes for the null terminator.
final boolean nullIsOneByte = StandardCharsets.ISO_8859_1 == charset || StandardCharsets.UTF_8 == charset;
boolean isNullTerminatorFound = false;
while (buffer.hasRemaining())
{
byte nextByte = buffer.get();
if (nextByte == 0x00)
{
if (nullIsOneByte)
{
buffer.mark();
buffer.reset();
endPosition = buffer.position() - 1;
logger.finest("Null terminator found starting at:" + endPosition);
isNullTerminatorFound = true;
break;
}
else
{
// Looking for two-byte null
if (buffer.hasRemaining())
{
nextByte = buffer.get();
if (nextByte == 0x00)
{
buffer.mark();
buffer.reset();
endPosition = buffer.position() - 2;
logger.finest("UTF16:Null terminator found starting at:" + endPosition);
isNullTerminatorFound = true;
break;
}
else
{
//Nothing to do, we have checked 2nd value of pair it was not a null terminator
//so will just start looking again in next invocation of loop
}
}
else
{
buffer.mark();
buffer.reset();
endPosition = buffer.position() - 1;
logger.warning("UTF16:Should be two null terminator marks but only found one starting at:" + endPosition);
isNullTerminatorFound = true;
break;
}
}
}
else
{
//If UTF16, we should only be looking on 2 byte boundaries
if (!nullIsOneByte)
{
if (buffer.hasRemaining())
{
buffer.get();
}
}
}
}
if (!isNullTerminatorFound)
{
throw new InvalidDataTypeException("Unable to find null terminated string");
}
logger.finest("End Position is:" + endPosition + "Offset:" + offset);
//Set Size so offset is ready for next field (includes the null terminator)
size = endPosition - offset;
size++;
if (!nullIsOneByte)
{
size++;
}
setSize(size);
//Decode buffer if runs into problems should throw exception which we
//catch and then set value to empty string. (We don't read the null terminator
//because we dont want to display this)
bufferSize = endPosition - offset;
logger.finest("Text size is:" + bufferSize);
if (bufferSize == 0)
{
value = "";
}
else
{
//Decode sliced inBuffer
ByteBuffer inBuffer = ByteBuffer.wrap(arr, offset, bufferSize).slice();
CharBuffer outBuffer = CharBuffer.allocate(bufferSize);
final CharsetDecoder decoder = getCorrectDecoder(inBuffer);
CoderResult coderResult = decoder.decode(inBuffer, outBuffer, true);
if (coderResult.isError())
{
logger.warning("Problem decoding text encoded null terminated string:" + coderResult);
}
decoder.flush(outBuffer);
outBuffer.flip();
value = outBuffer.toString();
}
//Set Size so offset is ready for next field (includes the null terminator)
logger.config("Read NullTerminatedString:" + value + " size inc terminator:" + size);
} |
Read a string from buffer upto null character (if exists)
Must take into account the text encoding defined in the Encoding Object
ID3 Text Frames often allow multiple strings separated by the null char
appropriate for the encoding.
@param arr this is the buffer for the frame
@param offset this is where to start reading in the buffer for this field
| TextEncodedStringNullTerminated::readByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringNullTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringNullTerminated.java | Apache-2.0 |
public byte[] writeByteArray()
{
logger.config("Writing NullTerminatedString." + value);
byte[] data;
//Write to buffer using the CharSet defined by getTextEncodingCharSet()
//Add a null terminator which will be encoded based on encoding.
final Charset charset = getTextEncodingCharSet();
try
{
if (StandardCharsets.UTF_16.equals(charset))
{
if(TagOptionSingleton.getInstance().isEncodeUTF16BomAsLittleEndian())
{
final CharsetEncoder encoder = StandardCharsets.UTF_16LE.newEncoder();
encoder.onMalformedInput(CodingErrorAction.IGNORE);
encoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
//Note remember LE BOM is ff fe but this is handled by encoder Unicode char is fe ff
final ByteBuffer bb = encoder.encode(CharBuffer.wrap('\ufeff' + (String) value + '\0'));
data = new byte[bb.limit()];
bb.get(data, 0, bb.limit());
}
else
{
final CharsetEncoder encoder = StandardCharsets.UTF_16BE.newEncoder();
encoder.onMalformedInput(CodingErrorAction.IGNORE);
encoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
//Note BE BOM will leave as fe ff
final ByteBuffer bb = encoder.encode(CharBuffer.wrap('\ufeff' + (String) value + '\0'));
data = new byte[bb.limit()];
bb.get(data, 0, bb.limit());
}
}
else
{
final CharsetEncoder encoder = charset.newEncoder();
encoder.onMalformedInput(CodingErrorAction.IGNORE);
encoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
final ByteBuffer bb = encoder.encode(CharBuffer.wrap((String) value + '\0'));
data = new byte[bb.limit()];
bb.get(data, 0, bb.limit());
}
}
//https://bitbucket.org/ijabz/jaudiotagger/issue/1/encoding-metadata-to-utf-16-can-fail-if
catch (CharacterCodingException ce)
{
logger.severe(ce.getMessage()+":"+charset.name()+":"+value);
throw new RuntimeException(ce);
}
setSize(data.length);
return data;
} |
Write String into byte array, adding a null character to the end of the String
@return the data as a byte array in format to write to file
| TextEncodedStringNullTerminated::writeByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringNullTerminated.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TextEncodedStringNullTerminated.java | Apache-2.0 |
public List<V> getAlphabeticalValueList()
{
return valueList;
} |
Get list in alphabetical order
@return
| AbstractValuePair::getAlphabeticalValueList | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractValuePair.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractValuePair.java | Apache-2.0 |
public int getSize()
{
return valueList.size();
} |
@return the number of elements in the mapping
| AbstractValuePair::getSize | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractValuePair.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractValuePair.java | Apache-2.0 |
protected AbstractDataType(String identifier, AbstractTagFrameBody frameBody)
{
this.identifier = identifier;
this.frameBody = frameBody;
} |
Construct an abstract datatype identified by identifier and linked to a framebody without setting
an initial value.
@param identifier to allow retrieval of this datatype by name from framebody
@param frameBody that the dataype is associated with
| AbstractDataType::AbstractDataType | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | Apache-2.0 |
protected AbstractDataType(String identifier, AbstractTagFrameBody frameBody, Object value)
{
this.identifier = identifier;
this.frameBody = frameBody;
setValue(value);
} |
Construct an abstract datatype identified by identifier and linked to a framebody initilised with a value
@param identifier to allow retrieval of this datatype by name from framebody
@param frameBody that the dataype is associated with
@param value of this DataType
| AbstractDataType::AbstractDataType | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | Apache-2.0 |
public AbstractDataType(AbstractDataType copyObject)
{
// no copy constructor in super class
this.identifier = copyObject.identifier;
if (copyObject.value == null)
{
this.value = null;
}
else if (copyObject.value instanceof String)
{
this.value = copyObject.value;
}
else if (copyObject.value instanceof Boolean)
{
this.value = copyObject.value;
}
else if (copyObject.value instanceof Byte)
{
this.value = copyObject.value;
}
else if (copyObject.value instanceof Character)
{
this.value = copyObject.value;
}
else if (copyObject.value instanceof Double)
{
this.value = copyObject.value;
}
else if (copyObject.value instanceof Float)
{
this.value = copyObject.value;
}
else if (copyObject.value instanceof Integer)
{
this.value = copyObject.value;
}
else if (copyObject.value instanceof Long)
{
this.value = copyObject.value;
}
else if (copyObject.value instanceof Short)
{
this.value = copyObject.value;
}
else if(copyObject.value instanceof MultipleTextEncodedStringNullTerminated.Values)
{
this.value = copyObject.value;
}
else if(copyObject.value instanceof PairedTextEncodedStringNullTerminated.ValuePairs)
{
this.value = copyObject.value;
}
else if(copyObject.value instanceof PartOfSet.PartOfSetValue)
{
this.value = copyObject.value;
}
else if (copyObject.value instanceof boolean[])
{
this.value = ((boolean[]) copyObject.value).clone();
}
else if (copyObject.value instanceof byte[])
{
this.value = ((byte[]) copyObject.value).clone();
}
else if (copyObject.value instanceof char[])
{
this.value = ((char[]) copyObject.value).clone();
}
else if (copyObject.value instanceof double[])
{
this.value = ((double[]) copyObject.value).clone();
}
else if (copyObject.value instanceof float[])
{
this.value = ((float[]) copyObject.value).clone();
}
else if (copyObject.value instanceof int[])
{
this.value = ((int[]) copyObject.value).clone();
}
else if (copyObject.value instanceof long[])
{
this.value = ((long[]) copyObject.value).clone();
}
else if (copyObject.value instanceof short[])
{
this.value = ((short[]) copyObject.value).clone();
}
else if (copyObject.value instanceof Object[])
{
this.value = ((Object[]) copyObject.value).clone();
}
else if (copyObject.value instanceof ArrayList)
{
this.value = ((ArrayList) copyObject.value).clone();
}
else if (copyObject.value instanceof LinkedList)
{
this.value = ((LinkedList) copyObject.value).clone();
}
else
{
throw new UnsupportedOperationException("Unable to create copy of class " + copyObject.getClass());
}
} |
This is used by subclasses, to clone the data within the copyObject
TODO:It seems to be missing some of the more complex value types.
@param copyObject
| AbstractDataType::AbstractDataType | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | Apache-2.0 |
public void setBody(AbstractTagFrameBody frameBody)
{
this.frameBody = frameBody;
} |
Set the framebody that this datatype is associated with
@param frameBody
| AbstractDataType::setBody | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | Apache-2.0 |
public AbstractTagFrameBody getBody()
{
return frameBody;
} |
Get the framebody associated with this datatype
@return the framebody that this datatype is associated with
| AbstractDataType::getBody | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | Apache-2.0 |
public String getIdentifier()
{
return identifier;
} |
Return the key as declared by the frame bodies datatype list
@return the key used to reference this datatype from a framebody
| AbstractDataType::getIdentifier | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | Apache-2.0 |
public void setValue(Object value)
{
this.value = value;
} |
Set the value held by this datatype, this is used typically used when the
user wants to modify the value in an existing frame.
@param value
| AbstractDataType::setValue | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | Apache-2.0 |
public Object getValue()
{
return value;
} |
Get value held by this Object
@return value held by this Object
| AbstractDataType::getValue | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | Apache-2.0 |
final public void readByteArray(byte[] arr) throws InvalidDataTypeException
{
readByteArray(arr, 0);
} |
Simplified wrapper for reading bytes from file into Object.
Used for reading Strings, this class should be overridden
for non String Objects
@param arr
@throws org.jaudiotagger.tag.InvalidDataTypeException
| AbstractDataType::readByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | Apache-2.0 |
public boolean equals(Object obj)
{
if(this==obj)
{
return true;
}
if (!(obj instanceof AbstractDataType object))
{
return false;
}
if (!this.identifier.equals(object.identifier))
{
return false;
}
if ((this.value == null) && (object.value == null))
{
return true;
}
else if ((this.value == null) || (object.value == null))
{
return false;
}
// boolean[]
if (this.value instanceof boolean[] && object.value instanceof boolean[])
{
return Arrays.equals((boolean[]) this.value, (boolean[]) object.value);
// byte[]
}
else if (this.value instanceof byte[] && object.value instanceof byte[])
{
return Arrays.equals((byte[]) this.value, (byte[]) object.value);
// char[]
}
else if (this.value instanceof char[] && object.value instanceof char[])
{
return Arrays.equals((char[]) this.value, (char[]) object.value);
// double[]
}
else if (this.value instanceof double[] && object.value instanceof double[])
{
return Arrays.equals((double[]) this.value, (double[]) object.value);
// float[]
}
else if (this.value instanceof float[] && object.value instanceof float[])
{
return Arrays.equals((float[]) this.value, (float[]) object.value);
// int[]
}
else if (this.value instanceof int[] && object.value instanceof int[])
{
return Arrays.equals((int[]) this.value, (int[]) object.value);
// long[]
}
else if (this.value instanceof long[] && object.value instanceof long[])
{
return Arrays.equals((long[]) this.value, (long[]) object.value);
// Object[]
}
else if (this.value instanceof Object[] && object.value instanceof Object[])
{
return Arrays.equals((Object[]) this.value, (Object[]) object.value);
// short[]
}
else if (this.value instanceof short[] && object.value instanceof short[])
{
return Arrays.equals((short[]) this.value, (short[]) object.value);
}
else return this.value.equals(object.value);
} |
@param obj
@return whether this and obj are deemed equivalent
| AbstractDataType::equals | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | Apache-2.0 |
public void createStructure()
{
MP3File.getStructureFormatter().addElement(identifier, getValue().toString());
} |
Return String Representation of Datatype *
| AbstractDataType::createStructure | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataType.java | Apache-2.0 |
protected AbstractDataTypeList(final AbstractDataTypeList<T> copy)
{
super(copy);
} |
Copy constructor.
By convention, subclasses <em>must</em> implement a constructor, accepting an argument of their own class type
and call this constructor for {@link org.jaudiotagger.tag.id3.ID3Tags#copyObject(Object)} to work.
A parametrized {@code AbstractDataTypeList} is not sufficient.
@param copy instance
| AbstractDataTypeList::AbstractDataTypeList | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataTypeList.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataTypeList.java | Apache-2.0 |
public int getSize()
{
int size = 0;
for (final T t : getValue()) {
size+=t.getSize();
}
return size;
} |
Return the size in byte of this datatype list.
@return the size in bytes
| AbstractDataTypeList::getSize | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataTypeList.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataTypeList.java | Apache-2.0 |
public void readByteArray(final byte[] buffer, final int offset) throws InvalidDataTypeException
{
if (buffer == null)
{
throw new NullPointerException("Byte array is null");
}
if (offset < 0)
{
throw new IndexOutOfBoundsException("Offset to byte array is out of bounds: offset = " + offset + ", array.length = " + buffer.length);
}
// no events
if (offset >= buffer.length)
{
getValue().clear();
return;
}
for (int currentOffset = offset; currentOffset<buffer.length;) {
final T data = createListElement();
data.readByteArray(buffer, currentOffset);
data.setBody(frameBody);
getValue().add(data);
currentOffset+=data.getSize();
}
} |
Reads list of {@link EventTimingCode}s from buffer starting at the given offset.
@param buffer buffer
@param offset initial offset into the buffer
@throws NullPointerException
@throws IndexOutOfBoundsException
| AbstractDataTypeList::readByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataTypeList.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataTypeList.java | Apache-2.0 |
public byte[] writeByteArray()
{
logger.config("Writing DataTypeList " + this.getIdentifier());
final byte[] buffer = new byte[getSize()];
int offset = 0;
for (final AbstractDataType data : getValue()) {
final byte[] bytes = data.writeByteArray();
System.arraycopy(bytes, 0, buffer, offset, bytes.length);
offset+=bytes.length;
}
return buffer;
} |
Write contents to a byte array.
@return a byte array that that contains the data that should be persisted to file
| AbstractDataTypeList::writeByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataTypeList.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractDataTypeList.java | Apache-2.0 |
public BooleanString(String identifier, AbstractTagFrameBody frameBody)
{
super(identifier, frameBody);
} |
Creates a new ObjectBooleanString datatype.
@param identifier
@param frameBody
| BooleanString::BooleanString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/BooleanString.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/BooleanString.java | Apache-2.0 |
public int getSize()
{
return 1;
} |
@return
| BooleanString::getSize | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/BooleanString.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/BooleanString.java | Apache-2.0 |
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException
{
byte b = arr[offset];
value = b != '0';
} |
@param offset
@throws NullPointerException
@throws IndexOutOfBoundsException
| BooleanString::readByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/BooleanString.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/BooleanString.java | Apache-2.0 |
public String toString()
{
return "" + value;
} |
@return
| BooleanString::toString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/BooleanString.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/BooleanString.java | Apache-2.0 |
public byte[] writeByteArray()
{
byte[] booleanValue = new byte[1];
if (value == null)
{
booleanValue[0] = '0';
}
else
{
if ((Boolean) value)
{
booleanValue[0] = '0';
}
else
{
booleanValue[0] = '1';
}
}
return booleanValue;
} |
@return
| BooleanString::writeByteArray | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/tag/datatype/BooleanString.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/BooleanString.java | Apache-2.0 |
public boolean accept(File f)
{
if (f.isHidden() || !f.canRead())
{
return false;
}
if (f.isDirectory())
{
return allowDirectories;
}
String ext = Utils.getExtension(f);
try
{
if (SupportedFileFormat.valueOf(ext.toUpperCase()) != null)
{
return true;
}
}
catch(IllegalArgumentException iae)
{
//Not known enum value
return false;
}
return false;
} |
<p>Check whether the given file meet the required conditions (supported by the library OR directory).
The File must also be readable and not hidden.
@param f The file to test
@return a boolean indicating if the file is accepted or not
| AudioFileFilter::accept | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/audio/AudioFileFilter.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/audio/AudioFileFilter.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.