code
stringlengths
11
173k
docstring
stringlengths
2
593k
func_name
stringlengths
2
189
language
stringclasses
1 value
repo
stringclasses
833 values
path
stringlengths
11
294
url
stringlengths
60
339
license
stringclasses
4 values
public FieldFrameBodyETT(String title) { this.setObjectValue("Title", title); }
Creates a new FieldBodyETT datatype. @param title
FieldFrameBodyETT::FieldFrameBodyETT
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyETT.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyETT.java
Apache-2.0
public FieldFrameBodyETT(ByteBuffer byteBuffer) throws InvalidTagException { this.read(byteBuffer); }
Creates a new FieldBodyETT datatype. @param byteBuffer @throws InvalidTagException
FieldFrameBodyETT::FieldFrameBodyETT
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyETT.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyETT.java
Apache-2.0
public void setTitle(String title) { setObjectValue("Title", title); }
@param title
FieldFrameBodyETT::setTitle
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyETT.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyETT.java
Apache-2.0
public FieldFrameBodyIND() { // this.setObject("Lyrics Present", new Boolean(false)); // this.setObject("Timestamp Present", new Boolean(false)); }
Creates a new FieldBodyIND datatype.
FieldFrameBodyIND::FieldFrameBodyIND
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyIND.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyIND.java
Apache-2.0
public FieldFrameBodyIND(boolean lyricsPresent, boolean timeStampPresent) { this.setObjectValue("Lyrics Present", lyricsPresent); this.setObjectValue("Timestamp Present", timeStampPresent); }
Creates a new FieldBodyIND datatype. @param lyricsPresent @param timeStampPresent
FieldFrameBodyIND::FieldFrameBodyIND
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyIND.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyIND.java
Apache-2.0
public FieldFrameBodyIND(ByteBuffer byteBuffer) throws InvalidTagException { this.read(byteBuffer); }
Creates a new FieldBodyIND datatype. @param byteBuffer @throws InvalidTagException
FieldFrameBodyIND::FieldFrameBodyIND
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyIND.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyIND.java
Apache-2.0
public FieldFrameBodyINF() { // this.setObject("Additional Information", ""); }
Creates a new FieldBodyINF datatype.
FieldFrameBodyINF::FieldFrameBodyINF
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyINF.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyINF.java
Apache-2.0
public FieldFrameBodyINF(String additionalInformation) { this.setObjectValue("Additional Information", additionalInformation); }
Creates a new FieldBodyINF datatype. @param additionalInformation
FieldFrameBodyINF::FieldFrameBodyINF
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyINF.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyINF.java
Apache-2.0
public FieldFrameBodyINF(ByteBuffer byteBuffer) throws InvalidTagException { this.read(byteBuffer); }
Creates a new FieldBodyINF datatype. @param byteBuffer @throws org.jaudiotagger.tag.InvalidTagException
FieldFrameBodyINF::FieldFrameBodyINF
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyINF.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyINF.java
Apache-2.0
public void setAdditionalInformation(String additionalInformation) { setObjectValue("Additional Information", additionalInformation); }
@param additionalInformation
FieldFrameBodyINF::setAdditionalInformation
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyINF.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyINF.java
Apache-2.0
public FieldFrameBodyEAR() { // this.setObject("Artist", ""); }
Creates a new FieldBodyEAR datatype.
FieldFrameBodyEAR::FieldFrameBodyEAR
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyEAR.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyEAR.java
Apache-2.0
public FieldFrameBodyEAR(String artist) { this.setObjectValue("Artist", artist); }
Creates a new FieldBodyEAR datatype. @param artist
FieldFrameBodyEAR::FieldFrameBodyEAR
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyEAR.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyEAR.java
Apache-2.0
public FieldFrameBodyEAR(ByteBuffer byteBuffer) throws InvalidTagException { this.read(byteBuffer); }
Creates a new FieldBodyEAR datatype. @param byteBuffer @throws InvalidTagException
FieldFrameBodyEAR::FieldFrameBodyEAR
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyEAR.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyEAR.java
Apache-2.0
public void setArtist(String artist) { setObjectValue("Artist", artist); }
@param artist
FieldFrameBodyEAR::setArtist
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyEAR.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/lyrics3/FieldFrameBodyEAR.java
Apache-2.0
public boolean isExistingInfoTag() { return isExistingInfoTag; }
@return true if the file that this tag read from already contains a LISTINFO chunk
WavTag::isExistingInfoTag
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
Apache-2.0
public WavInfoTag getInfoTag() { return infoTag; }
@return the Info tag
WavTag::getInfoTag
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
Apache-2.0
public boolean isInfoTag() { return infoTag != null; }
Does the info tag exist, note it is created by default if one does not exist in file it was read from @return
WavTag::isInfoTag
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
Apache-2.0
public boolean isID3Tag() { return id3Tag != null; }
Does an ID3 tag exist, note it is created by default if one does not exist in file it was read from @return
WavTag::isID3Tag
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
Apache-2.0
public boolean isEmpty() { return (getActiveTag() == null || getActiveTag().isEmpty()); }
Determines whether the tag has no fields specified.<br> <p/> <p>If there are no images we return empty if either there is no VorbisTag or if there is a VorbisTag but it is empty @return <code>true</code> if tag contains no field.
WavTag::isEmpty
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
Apache-2.0
public TagField createField(Artwork artwork) throws FieldDataInvalidException { return getActiveTag().createField(artwork); }
Create artwork field. Not currently supported.
WavTag::createField
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
Apache-2.0
public boolean hasField(FieldKey genericKey) { return getActiveTag().hasField(genericKey); }
@param genericKey @return
WavTag::hasField
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
Apache-2.0
public long getSizeOfID3TagOnly() { if(!isExistingId3Tag()) { return 0; } return (id3Tag.getEndLocationInFile() - id3Tag.getStartLocationInFile()); }
@return size of the vanilla ID3Tag exclusing surrounding chunk
WavTag::getSizeOfID3TagOnly
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
Apache-2.0
public long getSizeOfID3TagIncludingChunkHeader() { if(!isExistingId3Tag()) { return 0; } return getSizeOfID3TagOnly() + ChunkHeader.CHUNK_HEADER_SIZE; }
@return size of the ID3 Chunk including header
WavTag::getSizeOfID3TagIncludingChunkHeader
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
Apache-2.0
public long getStartLocationInFileOfId3Chunk() { if(!isExistingId3Tag()) { return 0; } return id3Tag.getStartLocationInFile() - ChunkHeader.CHUNK_HEADER_SIZE; }
Offset into file of start ID3Chunk including header @return
WavTag::getStartLocationInFileOfId3Chunk
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
Apache-2.0
public void syncToId3FromInfoIfEmpty() { try { for(FieldKey fieldKey : WavInfoTag.getSupportedKeys()) { if (id3Tag.getFirst(fieldKey).isEmpty()) { String first = infoTag.getFirst(fieldKey); if (!first.isEmpty()) { id3Tag.setField(fieldKey, stripNullTerminator(first)); } } } } catch(FieldDataInvalidException deie) { logger.log(Level.INFO, "Couldn't sync to ID3 because the data to sync was invalid", deie); } }
If we have field in INFO tag but not ID3 tag (perhaps coz doesn't exist add them to ID3 tag)
WavTag::syncToId3FromInfoIfEmpty
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
Apache-2.0
public void syncToId3FromInfoOverwrite() { try { for(FieldKey fieldKey : WavInfoTag.getSupportedKeys()) { if (!infoTag.getFirst(fieldKey).isEmpty()) { id3Tag.setField(fieldKey, stripNullTerminator(infoTag.getFirst(fieldKey))); } else { id3Tag.deleteField(fieldKey); } } } catch(FieldDataInvalidException deie) { logger.log(Level.INFO, "Couldn't sync to ID3 because the data to sync was invalid", deie); } }
If we have field in INFO tag write to ID3 tag, if not we delete form ID3 (but only for tag that we can actually have in INFO tag)
WavTag::syncToId3FromInfoOverwrite
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
Apache-2.0
public void syncToInfoFromId3Overwrite() { try { for(FieldKey fieldKey : WavInfoTag.getSupportedKeys()) { if (!id3Tag.getFirst(fieldKey).isEmpty()) { infoTag.setField(fieldKey, addNullTerminatorIfNone(id3Tag.getFirst(fieldKey))); } else { infoTag.deleteField(fieldKey); } } } catch(FieldDataInvalidException deie) { logger.log(Level.INFO, "Couldn't sync to INFO because the data to sync was invalid", deie); } }
If we have field in ID3 tag write to INFO tag
WavTag::syncToInfoFromId3Overwrite
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
Apache-2.0
public void syncTagsAfterRead() { if(getActiveTag() instanceof WavInfoTag) { syncToInfoFromId3IfEmpty(); } else { syncToId3FromInfoIfEmpty(); } }
Call after read to ensure your preferred tag can make use of any additional metadata held in the other tag, only used if the activetag field is empty for the fieldkey
WavTag::syncTagsAfterRead
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
Apache-2.0
public void syncTagBeforeWrite() { if(getActiveTag() instanceof WavInfoTag) { syncToId3FromInfoOverwrite(); } else { syncToInfoFromId3Overwrite(); } }
Call before save if saving both tags ensure any new information is the active tag is added to the other tag overwriting any existing fields
WavTag::syncTagBeforeWrite
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/wav/WavTag.java
Apache-2.0
public NumberHashMap(String identifier, AbstractTagFrameBody frameBody, int size) { super(identifier, frameBody, size); if (identifier.equals(DataTypes.OBJ_GENRE)) { valueToKey = GenreTypes.getInstanceOf().getValueToIdMap(); keyToValue = GenreTypes.getInstanceOf().getIdToValueMap(); //genres can be an id or literal value hasEmptyValue = true; } else if (identifier.equals(DataTypes.OBJ_TEXT_ENCODING)) { valueToKey = TextEncoding.getInstanceOf().getValueToIdMap(); keyToValue = TextEncoding.getInstanceOf().getIdToValueMap(); } else if (identifier.equals(DataTypes.OBJ_INTERPOLATION_METHOD)) { valueToKey = InterpolationTypes.getInstanceOf().getValueToIdMap(); keyToValue = InterpolationTypes.getInstanceOf().getIdToValueMap(); } else if (identifier.equals(DataTypes.OBJ_PICTURE_TYPE)) { valueToKey = PictureTypes.getInstanceOf().getValueToIdMap(); keyToValue = PictureTypes.getInstanceOf().getIdToValueMap(); //Issue #224 Values should map, but have examples where they dont, this is a workaround hasEmptyValue = true; } else if (identifier.equals(DataTypes.OBJ_TYPE_OF_EVENT)) { valueToKey = EventTimingTypes.getInstanceOf().getValueToIdMap(); keyToValue = EventTimingTypes.getInstanceOf().getIdToValueMap(); } else if (identifier.equals(DataTypes.OBJ_TIME_STAMP_FORMAT)) { valueToKey = EventTimingTimestampTypes.getInstanceOf().getValueToIdMap(); keyToValue = EventTimingTimestampTypes.getInstanceOf().getIdToValueMap(); } else if (identifier.equals(DataTypes.OBJ_TYPE_OF_CHANNEL)) { valueToKey = ChannelTypes.getInstanceOf().getValueToIdMap(); keyToValue = ChannelTypes.getInstanceOf().getIdToValueMap(); } else if (identifier.equals(DataTypes.OBJ_RECIEVED_AS)) { valueToKey = ReceivedAsTypes.getInstanceOf().getValueToIdMap(); keyToValue = ReceivedAsTypes.getInstanceOf().getIdToValueMap(); } else if (identifier.equals(DataTypes.OBJ_CONTENT_TYPE)) { valueToKey = SynchronisedLyricsContentType.getInstanceOf().getValueToIdMap(); keyToValue = SynchronisedLyricsContentType.getInstanceOf().getIdToValueMap(); } else { throw new IllegalArgumentException("Hashmap identifier not defined in this class: " + identifier); } }
Creates a new ObjectNumberHashMap datatype. @param identifier @param frameBody @param size @throws IllegalArgumentException
NumberHashMap::NumberHashMap
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/NumberHashMap.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberHashMap.java
Apache-2.0
public Map<Integer, String> getKeyToValue() { return keyToValue; }
@return the key to value map
NumberHashMap::getKeyToValue
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/NumberHashMap.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberHashMap.java
Apache-2.0
public Map<String, Integer> getValueToKey() { return valueToKey; }
@return the value to key map
NumberHashMap::getValueToKey
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/NumberHashMap.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberHashMap.java
Apache-2.0
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException { super.readByteArray(arr, offset); //Mismatch:Superclass uses Long, but maps expect Integer Integer intValue = ((Long) value).intValue(); if (!keyToValue.containsKey(intValue)) { if (!hasEmptyValue) { throw new InvalidDataTypeException(ErrorMessage.MP3_REFERENCE_KEY_INVALID.getMsg(identifier, intValue)); } else if (identifier.equals(DataTypes.OBJ_PICTURE_TYPE)) { logger.warning(ErrorMessage.MP3_PICTURE_TYPE_INVALID.getMsg(value)); } } }
Read the key from the buffer. @param arr @param offset @throws InvalidDataTypeException if emptyValues are not allowed and the eky was invalid.
NumberHashMap::readByteArray
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/NumberHashMap.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberHashMap.java
Apache-2.0
public int getSize() { int len = 0; if (value != null) { len = ((byte[]) value).length; } return len; }
Return the size in byte of this datatype @return the size in bytes
ByteArraySizeTerminated::getSize
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/ByteArraySizeTerminated.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/ByteArraySizeTerminated.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) { throw new IndexOutOfBoundsException("Offset to byte array is out of bounds: offset = " + offset + ", array.length = " + arr.length); } //Empty Byte Array if (offset >= arr.length) { value = null; return; } int len = arr.length - offset; value = new byte[len]; System.arraycopy(arr, offset, value, 0, len); }
@param arr @param offset @throws NullPointerException @throws IndexOutOfBoundsException
ByteArraySizeTerminated::readByteArray
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/ByteArraySizeTerminated.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/ByteArraySizeTerminated.java
Apache-2.0
public String toString() { return getSize() + " bytes"; }
Because this is usually binary data and could be very long we just return the number of bytes held @return the number of bytes
ByteArraySizeTerminated::toString
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/ByteArraySizeTerminated.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/ByteArraySizeTerminated.java
Apache-2.0
public byte[] writeByteArray() { logger.config("Writing byte array" + this.getIdentifier()); return (byte[]) value; }
Write contents to a byte array @return a byte array that that contians the data that should be perisisted to file
ByteArraySizeTerminated::writeByteArray
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/ByteArraySizeTerminated.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/ByteArraySizeTerminated.java
Apache-2.0
public TCONString(String identifier, AbstractTagFrameBody frameBody) { super(identifier, frameBody); }
Creates a new empty TextEncodedStringSizeTerminated datatype. @param identifier identifies the frame type @param frameBody
TCONString::TCONString
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/TCONString.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TCONString.java
Apache-2.0
public TCONString(TCONString object) { super(object); }
Copy constructor @param object
TCONString::TCONString
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/TCONString.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TCONString.java
Apache-2.0
public boolean isNullSeperateMultipleValues() { return isNullSeperateMultipleValues; }
If this field is used with ID3v24 then it is usual to null separate values. Within ID3v23 not many frames officially support multiple values, so in absense of better solution we use the v24 method, however some frames such as TCON have there own method and should not null separate values. This can be controlled by this field.
TCONString::isNullSeperateMultipleValues
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/TCONString.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TCONString.java
Apache-2.0
public int getNumberOfValues() { return getValues().size(); }
How many values are held, each value is separated by a null terminator @return number of values held, usually this will be one.
TCONString::getNumberOfValues
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/TCONString.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TCONString.java
Apache-2.0
public String getValueAtIndex(int index) { //Split String into separate components List values = getValues(); return (String) values.get(index); }
Get the nth value @param index @return the nth value @throws IndexOutOfBoundsException if value does not exist
TCONString::getValueAtIndex
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/TCONString.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TCONString.java
Apache-2.0
public List<String> getValues() { if(isNullSeperateMultipleValues()) { return splitByNullSeperator((String) value); } else { return splitV23((String)value); } }
@return list of all values
TCONString::getValues
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/TCONString.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TCONString.java
Apache-2.0
public String getValueWithoutTrailingNull() { List<String> values = getValues(); 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
TCONString::getValueWithoutTrailingNull
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/TCONString.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/TCONString.java
Apache-2.0
public StringSizeTerminated(String identifier, AbstractTagFrameBody frameBody) { super(identifier, frameBody); }
Creates a new ObjectStringSizeTerminated datatype. @param identifier identifies the frame type @param frameBody
StringSizeTerminated::StringSizeTerminated
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/StringSizeTerminated.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/StringSizeTerminated.java
Apache-2.0
public StringNullTerminated(String identifier, AbstractTagFrameBody frameBody) { super(identifier, frameBody); }
Creates a new ObjectStringNullTerminated datatype. @param identifier identifies the frame type @param frameBody
StringNullTerminated::StringNullTerminated
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/StringNullTerminated.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/StringNullTerminated.java
Apache-2.0
protected AbstractString(String identifier, AbstractTagFrameBody frameBody) { super(identifier, frameBody); }
Creates a new datatype @param identifier @param frameBody
AbstractString::AbstractString
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/AbstractString.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractString.java
Apache-2.0
public AbstractString(String identifier, AbstractTagFrameBody frameBody, String value) { super(identifier, frameBody, value); }
Creates a new datatype, with value @param identifier @param frameBody @param value
AbstractString::AbstractString
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/AbstractString.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractString.java
Apache-2.0
protected void setSize(int size) { this.size = size; }
Sets the size in bytes of this data type. This is set after writing the data to allow us to recalculate the size for frame header. @param size
AbstractString::setSize
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/AbstractString.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractString.java
Apache-2.0
public String toString() { return (String) value; }
Return String representation of data type @return a string representation of the value
AbstractString::toString
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/AbstractString.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractString.java
Apache-2.0
public boolean canBeEncoded() { //Try and write to buffer using the CharSet defined by the textEncoding field (note if using UTF16 we dont //need to worry about LE,BE at this point it makes no difference) final byte textEncoding = this.getBody().getTextEncoding(); final TextEncoding encoding = TextEncoding.getInstanceOf(); final Charset charset = encoding.getCharsetForId(textEncoding); CharsetEncoder encoder = charset.newEncoder(); if (encoder.canEncode((String) value)) { return true; } else { logger.finest("Failed Trying to decode" + value + "with" + encoder); return false; } }
Check the value can be encoded with the specified encoding @return
AbstractString::canBeEncoded
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/AbstractString.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractString.java
Apache-2.0
protected CharsetDecoder getCorrectDecoder(ByteBuffer inBuffer) { CharsetDecoder decoder=null; if(inBuffer.remaining()<=2) { decoder = getTextEncodingCharSet().newDecoder(); decoder.reset(); return decoder; } if(getTextEncodingCharSet()== StandardCharsets.UTF_16) { if(inBuffer.getChar(0)==0xfffe || inBuffer.getChar(0)==0xfeff) { //Get the Specified Decoder decoder = getTextEncodingCharSet().newDecoder(); decoder.reset(); } else { if(inBuffer.get(0)==0) { decoder = StandardCharsets.UTF_16BE.newDecoder(); decoder.reset(); } else { decoder = StandardCharsets.UTF_16LE.newDecoder(); decoder.reset(); } } } else { decoder = getTextEncodingCharSet().newDecoder(); decoder.reset(); } return decoder; }
If they have specified UTF-16 then decoder works out by looking at BOM but if missing we have to make an educated guess otherwise just use specified decoder @param inBuffer @return
AbstractString::getCorrectDecoder
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/AbstractString.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractString.java
Apache-2.0
protected Charset getTextEncodingCharSet() { final byte textEncoding = this.getBody().getTextEncoding(); final Charset charSetName = TextEncoding.getInstanceOf().getCharsetForId(textEncoding); logger.finest("text encoding:" + textEncoding + " charset:" + charSetName.name()); return charSetName; }
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
AbstractString::getTextEncodingCharSet
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/AbstractString.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/AbstractString.java
Apache-2.0
public StringFixedLength(String identifier, AbstractTagFrameBody frameBody, int size) { super(identifier, frameBody); if (size < 0) { throw new IllegalArgumentException("size is less than zero: " + size); } setSize(size); }
Creates a new ObjectStringFixedsize datatype. @param identifier @param frameBody @param size @throws IllegalArgumentException
StringFixedLength::StringFixedLength
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/StringFixedLength.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/StringFixedLength.java
Apache-2.0
public boolean equals(Object obj) { if (!(obj instanceof StringFixedLength object)) { return false; } return this.size == object.size && super.equals(obj); }
@param obj @return if obj is equivalent to this
StringFixedLength::equals
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/StringFixedLength.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/StringFixedLength.java
Apache-2.0
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException { logger.config("Reading from array from offset:" + offset); try { final CharsetDecoder decoder = getTextEncodingCharSet().newDecoder(); //Decode buffer if runs into problems should through exception which we //catch and then set value to empty string. logger.finest("Array length is:" + arr.length + "offset is:" + offset + "Size is:" + size); if (arr.length - offset < size) { throw new InvalidDataTypeException("byte array is to small to retrieve string of declared length:" + size); } String str = decoder.decode(ByteBuffer.wrap(arr, offset, size)).toString(); if (str == null) { throw new NullPointerException("String is null"); } value = str; } catch (CharacterCodingException ce) { logger.severe(ce.getMessage()); value = ""; } logger.config("Read StringFixedLength:" + value); }
Read a string from buffer of fixed size(size has already been set in constructor) @param arr this is the buffer for the frame @param offset this is where to start reading in the buffer for this field
StringFixedLength::readByteArray
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/StringFixedLength.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/StringFixedLength.java
Apache-2.0
public byte[] writeByteArray() { ByteBuffer dataBuffer; byte[] data; //Create with a series of empty of spaces to try and ensure integrity of field if (value == null) { logger.warning("Value of StringFixedlength Field is null using default value instead"); data = new byte[size]; for (int i = 0; i < size; i++) { data[i] = ' '; } return data; } try { final Charset charset = getTextEncodingCharSet(); final CharsetEncoder encoder; if (StandardCharsets.UTF_16.equals(charset)) { //Note remember LE BOM is ff fe but tis is handled by encoder Unicode char is fe ff encoder = StandardCharsets.UTF_16LE.newEncoder(); dataBuffer = encoder.encode(CharBuffer.wrap('\ufeff' + (String) value)); } else { encoder = charset.newEncoder(); dataBuffer = encoder.encode(CharBuffer.wrap((String) value)); } } catch (CharacterCodingException ce) { logger.warning("There was a problem writing the following StringFixedlength Field:" + value + ":" + ce.getMessage() + "using default value instead"); data = new byte[size]; for (int i = 0; i < size; i++) { data[i] = ' '; } return data; } // We must return the defined size. // To check now because size is in bytes not chars if (dataBuffer != null) { //Everything ok if (dataBuffer.limit() == size) { data = new byte[dataBuffer.limit()]; dataBuffer.get(data, 0, dataBuffer.limit()); return data; } //There is more data available than allowed for this field strip else if (dataBuffer.limit() > size) { logger.warning("There was a problem writing the following StringFixedlength Field:" + value + " when converted to bytes has length of:" + dataBuffer.limit() + " but field was defined with length of:" + size + " too long so stripping extra length"); data = new byte[size]; dataBuffer.get(data, 0, size); return data; } //There is not enough data else { logger.warning("There was a problem writing the following StringFixedlength Field:" + value + " when converted to bytes has length of:" + dataBuffer.limit() + " but field was defined with length of:" + size + " too short so padding with spaces to make up extra length"); data = new byte[size]; dataBuffer.get(data, 0, dataBuffer.limit()); for (int i = dataBuffer.limit(); i < size; i++) { data[i] = ' '; } return data; } } else { logger.warning("There was a serious problem writing the following StringFixedlength Field:" + value + ":" + "using default value instead"); data = new byte[size]; for (int i = 0; i < size; i++) { data[i] = ' '; } return data; } }
Write String into byte array The string will be adjusted to ensure the correct number of bytes are written, If the current value is null or to short the written value will have the 'space' character appended to ensure this. We write this instead of the null character because the null character is likely to confuse the parser into misreading the next field. @return the byte array to be written to the file
StringFixedLength::writeByteArray
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/StringFixedLength.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/StringFixedLength.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; }
@return the encoding of the frame body this datatype belongs to
StringFixedLength::getTextEncodingCharSet
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/StringFixedLength.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/StringFixedLength.java
Apache-2.0
public StringHashMap(String identifier, AbstractTagFrameBody frameBody, int size) { super(identifier, frameBody, size); if (identifier.equals(DataTypes.OBJ_LANGUAGE)) { valueToKey = Languages.getInstanceOf().getValueToIdMap(); keyToValue = Languages.getInstanceOf().getIdToValueMap(); } else { throw new IllegalArgumentException("Hashmap identifier not defined in this class: " + identifier); } }
Creates a new ObjectStringHashMap datatype. @param identifier @param frameBody @param size @throws IllegalArgumentException
StringHashMap::StringHashMap
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/StringHashMap.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/StringHashMap.java
Apache-2.0
protected Charset getTextEncodingCharSet() { return ISO_8859_1; }
@return the ISO_8859 encoding for Datatypes of this type
StringHashMap::getTextEncodingCharSet
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/StringHashMap.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/StringHashMap.java
Apache-2.0
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException { logger.finer("Reading MultipleTextEncodedStringNullTerminated from array from offset:" + offset); //Continue until unable to read a null terminated String while (true) { try { //Read String TextEncodedStringNullTerminated next = new TextEncodedStringNullTerminated(identifier, frameBody); next.readByteArray(arr, offset); if (next.getSize() == 0) { break; } else { //Add to value ((Values) value).add((String) next.getValue()); //Add to size calculation size += next.getSize(); //Increment Offset to start of next datatype. offset += next.getSize(); } } catch (InvalidDataTypeException idte) { break; } if (size == 0) { logger.warning("No null terminated Strings found"); throw new InvalidDataTypeException("No null terminated Strings found"); } } logger.finer("Read MultipleTextEncodedStringNullTerminated:" + value + " size:" + size); }
Read Null Terminated Strings from the array starting at offset, continue until unable to find any null terminated Strings or until reached the end of the array. The offset should be set to byte after the last null terminated String found. @param arr to read the Strings from @param offset in the array to start reading from @throws InvalidDataTypeException if unable to find any null terminated Strings
MultipleTextEncodedStringNullTerminated::readByteArray
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/MultipleTextEncodedStringNullTerminated.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/MultipleTextEncodedStringNullTerminated.java
Apache-2.0
public byte[] writeByteArray() { logger.finer("Writing MultipleTextEncodedStringNullTerminated"); int localSize = 0; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try { for (ListIterator<String> li = ((Values) value).getList().listIterator(); li.hasNext();) { TextEncodedStringNullTerminated next = new TextEncodedStringNullTerminated(identifier, frameBody, li.next()); buffer.write(next.writeByteArray()); localSize += next.getSize(); } } catch (IOException ioe) { //This should never happen because the write is internal with the JVM it is not to a file logger.log(Level.SEVERE, "IOException in MultipleTextEncodedStringNullTerminated when writing byte array", ioe); throw new RuntimeException(ioe); } //Update size member variable size = localSize; logger.finer("Written MultipleTextEncodedStringNullTerminated"); return buffer.toByteArray(); }
For every String write to bytebuffer @return bytebuffer that should be written to file to persist this datatype.
MultipleTextEncodedStringNullTerminated::writeByteArray
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/MultipleTextEncodedStringNullTerminated.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/MultipleTextEncodedStringNullTerminated.java
Apache-2.0
public void add(String value) { valueList.add(value); }
Add String Data type to the value list @param value to add to the list
Values::add
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/MultipleTextEncodedStringNullTerminated.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/MultipleTextEncodedStringNullTerminated.java
Apache-2.0
public List<String> getList() { return valueList; }
Return the list of values @return the list of values
Values::getList
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/MultipleTextEncodedStringNullTerminated.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/MultipleTextEncodedStringNullTerminated.java
Apache-2.0
public int getNumberOfValues() { return valueList.size(); }
@return no of values
Values::getNumberOfValues
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/MultipleTextEncodedStringNullTerminated.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/MultipleTextEncodedStringNullTerminated.java
Apache-2.0
public String toString() { StringBuffer sb = new StringBuffer(); for (ListIterator<String> li = valueList.listIterator(); li.hasNext();) { String next = li.next(); sb.append(next); if (li.hasNext()) { sb.append(","); } } return sb.toString(); }
Return the list of values as a single string separated by a comma @return a string representation of the value
Values::toString
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/MultipleTextEncodedStringNullTerminated.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/MultipleTextEncodedStringNullTerminated.java
Apache-2.0
public Lyrics3Image(String identifier, AbstractTagFrameBody frameBody) { super(identifier, frameBody); }
Creates a new ObjectLyrics3Image datatype. @param identifier @param frameBody
Lyrics3Image::Lyrics3Image
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Image.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Image.java
Apache-2.0
public void setFilename(String filename) { this.filename = filename; }
@param filename
Lyrics3Image::setFilename
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Image.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Image.java
Apache-2.0
public void setTimeStamp(Lyrics3TimeStamp time) { this.time = time; }
@param time
Lyrics3Image::setTimeStamp
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Image.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Image.java
Apache-2.0
public void readString(String imageString, int offset) { if (imageString == null) { throw new NullPointerException("Image string is null"); } if ((offset < 0) || (offset >= imageString.length())) { throw new IndexOutOfBoundsException("Offset to image string is out of bounds: offset = " + offset + ", string.length()" + imageString.length()); } if (imageString != null) { String timestamp; int delim; delim = imageString.indexOf("||", offset); filename = imageString.substring(offset, delim); offset = delim + 2; delim = imageString.indexOf("||", offset); description = imageString.substring(offset, delim); offset = delim + 2; timestamp = imageString.substring(offset); if (timestamp.length() == 7) { time = new Lyrics3TimeStamp("Time Stamp"); time.readString(timestamp); } } }
@param imageString @param offset @throws NullPointerException @throws IndexOutOfBoundsException
Lyrics3Image::readString
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Image.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/Lyrics3Image.java
Apache-2.0
public SynchronisedTempoCodeList(final SynchronisedTempoCodeList copy) { super(copy); }
Mandatory, concretely-typed copy constructor, as required by {@link org.jaudiotagger.tag.datatype.AbstractDataTypeList#AbstractDataTypeList(org.jaudiotagger.tag.datatype.AbstractDataTypeList)}. @param copy instance to copy
SynchronisedTempoCodeList::SynchronisedTempoCodeList
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/SynchronisedTempoCodeList.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/SynchronisedTempoCodeList.java
Apache-2.0
public NumberVariableLength(String identifier, AbstractTagFrameBody frameBody, int minimumSize) { super(identifier, frameBody); //Set minimum length, which can be zero if optional this.minLength = minimumSize; }
Creates a new ObjectNumberVariableLength datatype, set minimum length to zero if this datatype is optional. @param identifier @param frameBody @param minimumSize
NumberVariableLength::NumberVariableLength
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/NumberVariableLength.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberVariableLength.java
Apache-2.0
public int getMaximumLenth() { return MAXIMUM_NO_OF_DIGITS; }
Return the maximum number of digits that can be used to express the number @return the maximum number of digits that can be used to express the number
NumberVariableLength::getMaximumLenth
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/NumberVariableLength.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberVariableLength.java
Apache-2.0
public int getMinimumLength() { return minLength; }
Return the minimum number of digits that can be used to express the number @return the minimum number of digits that can be used to express the number
NumberVariableLength::getMinimumLength
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/NumberVariableLength.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberVariableLength.java
Apache-2.0
public void setMinimumSize(int minimumSize) { if (minimumSize > 0) { this.minLength = minimumSize; } }
@param minimumSize
NumberVariableLength::setMinimumSize
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/NumberVariableLength.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberVariableLength.java
Apache-2.0
public int getSize() { if (value == null) { return 0; } else { int current; long temp = ID3Tags.getWholeNumber(value); int size = 0; for (int i = MINIMUM_NO_OF_DIGITS; i <= MAXIMUM_NO_OF_DIGITS; i++) { current = (byte) temp & 0xFF; if (current != 0) { size = i; } temp >>= MAXIMUM_NO_OF_DIGITS; } return (minLength > size) ? minLength : size; } }
@return the number of bytes required to write this to a file
NumberVariableLength::getSize
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/NumberVariableLength.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberVariableLength.java
Apache-2.0
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException { //Coding error, should never happen if (arr == null) { throw new NullPointerException("Byte array is null"); } //Coding error, should never happen as far as I can see if (offset < 0) { throw new IllegalArgumentException("negativer offset into an array offset:" + offset); } //If optional then set value to zero, this will mean that if this frame is written back to file it will be created //with this additional datatype wheras it didnt exist but I think this is probably an advantage the frame is //more likely to be parsed by other applications if it contains optional fields. //if not optional problem with this frame if (offset >= arr.length) { if (minLength == 0) { value = (long) 0; return; } else { throw new InvalidDataTypeException("Offset to byte array is out of bounds: offset = " + offset + ", array.length = " + arr.length); } } long lvalue = 0; //Read the bytes (starting from offset), the most significant byte of the number being constructed is read first, //we then shift the resulting long one byte over to make room for the next byte for (int i = offset; i < arr.length; i++) { lvalue <<= 8; lvalue += (arr[i] & 0xff); } value = lvalue; }
Read from Byte Array @param arr @param offset @throws NullPointerException @throws IndexOutOfBoundsException
NumberVariableLength::readByteArray
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/NumberVariableLength.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberVariableLength.java
Apache-2.0
public String toString() { if (value == null) { return ""; } else { return value.toString(); } }
@return String representation of the number
NumberVariableLength::toString
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/NumberVariableLength.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberVariableLength.java
Apache-2.0
public byte[] writeByteArray() { int size = getSize(); byte[] arr; if (size == 0) { arr = new byte[0]; } else { long temp = ID3Tags.getWholeNumber(value); arr = new byte[size]; //keeps shifting the number downwards and masking the last 8 bist to get the value for the next byte //to be written for (int i = size - 1; i >= 0; i--) { arr[i] = (byte) (temp & 0xFF); temp >>= 8; } } return arr; }
Write to Byte Array @return the datatype converted to a byte array
NumberVariableLength::writeByteArray
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/NumberVariableLength.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/NumberVariableLength.java
Apache-2.0
public EventTimingCodeList(final EventTimingCodeList copy) { super(copy); }
Mandatory, concretely-typed copy constructor, as required by {@link AbstractDataTypeList#AbstractDataTypeList(AbstractDataTypeList)}. @param copy instance to copy
EventTimingCodeList::EventTimingCodeList
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/EventTimingCodeList.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/EventTimingCodeList.java
Apache-2.0
public StringDateTime(String identifier, AbstractTagFrameBody frameBody) { super(identifier, frameBody); }
Creates a new ObjectStringDateTime datatype. @param identifier @param frameBody
StringDateTime::StringDateTime
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/StringDateTime.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/StringDateTime.java
Apache-2.0
public boolean canBeEncoded() { for (Pair entry : ((ValuePairs) value).mapping) { TextEncodedStringNullTerminated next = new TextEncodedStringNullTerminated(identifier, frameBody, entry.getValue()); if (!next.canBeEncoded()) { return false; } } return true; }
Check the value can be encoded with the specified encoding @return
PairedTextEncodedStringNullTerminated::canBeEncoded
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/PairedTextEncodedStringNullTerminated.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/PairedTextEncodedStringNullTerminated.java
Apache-2.0
public byte[] writeByteArray() { logger.finer("Writing PairTextEncodedStringNullTerminated"); int localSize = 0; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try { for (Pair pair : ((ValuePairs) value).mapping) { { TextEncodedStringNullTerminated next = new TextEncodedStringNullTerminated(identifier, frameBody, pair.getKey()); buffer.write(next.writeByteArray()); localSize += next.getSize(); } { TextEncodedStringNullTerminated next = new TextEncodedStringNullTerminated(identifier, frameBody, pair.getValue()); buffer.write(next.writeByteArray()); localSize += next.getSize(); } } } catch (IOException ioe) { //This should never happen because the write is internal with the JVM it is not to a file logger.log(Level.SEVERE, "IOException in MultipleTextEncodedStringNullTerminated when writing byte array", ioe); throw new RuntimeException(ioe); } //Update size member variable size = localSize; logger.finer("Written PairTextEncodedStringNullTerminated"); return buffer.toByteArray(); }
For every String write to byteBuffer @return byteBuffer that should be written to file to persist this dataType.
PairedTextEncodedStringNullTerminated::writeByteArray
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/PairedTextEncodedStringNullTerminated.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/PairedTextEncodedStringNullTerminated.java
Apache-2.0
public int getNumberOfValues() { return mapping.size(); }
@return no of values
ValuePairs::getNumberOfValues
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/PairedTextEncodedStringNullTerminated.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/PairedTextEncodedStringNullTerminated.java
Apache-2.0
public String toString() { StringBuffer sb = new StringBuffer(); for(Pair next:mapping) { sb.append(next.getKey()+':'+next.getValue()+','); } if(sb.length()>0) { sb.setLength(sb.length() - 1); } return sb.toString(); }
Return the list of values as a single string separated by a colon,comma @return a string representation of the value
ValuePairs::toString
java
ZTFtrue/MonsterMusic
app/src/main/java/org/jaudiotagger/tag/datatype/PairedTextEncodedStringNullTerminated.java
https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/tag/datatype/PairedTextEncodedStringNullTerminated.java
Apache-2.0
public StringDate(String identifier, AbstractTagFrameBody frameBody) { super(identifier, frameBody, 8); }
Creates a new ObjectStringDate datatype. @param identifier @param frameBody
StringDate::StringDate
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 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
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 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 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 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