The following document contains the results of PMD's CPD 4.2.2.
| File | Line |
|---|---|
| org\jaudiotagger\tag\id3\ID3v23Tag.java | 904 |
| org\jaudiotagger\tag\id3\ID3v24Tag.java | 1251 |
return ID3v24PreferredFrameOrderComparator.getInstanceof();
}
public List<Artwork> getArtworkList()
{
List<TagField> coverartList = getFields(FieldKey.COVER_ART);
List<Artwork> artworkList = new ArrayList<Artwork>(coverartList.size());
for (TagField next : coverartList)
{
FrameBodyAPIC coverArt = (FrameBodyAPIC) ((AbstractID3v2Frame) next).getBody();
Artwork artwork = new Artwork();
artwork.setMimeType(coverArt.getMimeType());
artwork.setPictureType(coverArt.getPictureType());
if (coverArt.isImageUrl())
{
artwork.setLinked(true);
artwork.setImageUrl(coverArt.getImageUrl());
}
else
{
artwork.setBinaryData(coverArt.getImageData());
}
artworkList.add(artwork);
}
return artworkList;
}
public TagField createField(Artwork artwork) throws FieldDataInvalidException
{
AbstractID3v2Frame frame = createFrame(getFrameAndSubIdFromGenericKey(FieldKey.COVER_ART).getFrameId());
FrameBodyAPIC body = (FrameBodyAPIC) frame.getBody();
body.setObjectValue(DataTypes.OBJ_PICTURE_DATA, artwork.getBinaryData());
body.setObjectValue(DataTypes.OBJ_PICTURE_TYPE, artwork.getPictureType());
body.setObjectValue(DataTypes.OBJ_MIME_TYPE, artwork.getMimeType());
body.setObjectValue(DataTypes.OBJ_DESCRIPTION, "");
return frame;
}
/**
* Create Artwork
*
* @param data
* @param mimeType of the image
* @see PictureTypes
* @return
*/
public TagField createArtworkField(byte[] data, String mimeType)
{
AbstractID3v2Frame frame = createFrame(getFrameAndSubIdFromGenericKey(FieldKey.COVER_ART).getFrameId());
FrameBodyAPIC body = (FrameBodyAPIC) frame.getBody();
body.setObjectValue(DataTypes.OBJ_PICTURE_DATA, data);
body.setObjectValue(DataTypes.OBJ_PICTURE_TYPE, PictureTypes.DEFAULT_ID);
body.setObjectValue(DataTypes.OBJ_MIME_TYPE, mimeType);
body.setObjectValue(DataTypes.OBJ_DESCRIPTION, "");
return frame;
}
| |
| File | Line |
|---|---|
| org\jaudiotagger\tag\id3\ID3v22Tag.java | 505 |
| org\jaudiotagger\tag\id3\ID3v23Tag.java | 724 |
logger.info(getLoggingFilename() + ":bodybytebuffer:sizebeforeunsynchronisation:" + bodyByteBuffer.length);
// Unsynchronize if option enabled and unsync required
unsynchronization = TagOptionSingleton.getInstance().isUnsyncTags() && ID3Unsynchronization.requiresUnsynchronization(bodyByteBuffer);
if (isUnsynchronization())
{
bodyByteBuffer = ID3Unsynchronization.unsynchronize(bodyByteBuffer);
logger.info(getLoggingFilename() + ":bodybytebuffer:sizeafterunsynchronisation:" + bodyByteBuffer.length);
}
int sizeIncPadding = calculateTagSize(bodyByteBuffer.length + TAG_HEADER_LENGTH, (int) audioStartLocation);
int padding = sizeIncPadding - (bodyByteBuffer.length + TAG_HEADER_LENGTH);
logger.info(getLoggingFilename() + ":Current audiostart:" + audioStartLocation);
logger.info(getLoggingFilename() + ":Size including padding:" + sizeIncPadding);
logger.info(getLoggingFilename() + ":Padding:" + padding);
ByteBuffer headerBuffer = writeHeaderToBuffer(padding, bodyByteBuffer.length);
writeBufferToFile(file, headerBuffer, bodyByteBuffer, padding, sizeIncPadding, audioStartLocation);
}
/**
* {@inheritDoc}
*/
@Override
public void write(WritableByteChannel channel) throws IOException
{
logger.info(getLoggingFilename() + ":Writing tag to channel");
byte[] bodyByteBuffer = writeFramesToBuffer().toByteArray();
logger.info(getLoggingFilename() + ":bodybytebuffer:sizebeforeunsynchronisation:" + bodyByteBuffer.length);
// Unsynchronize if option enabled and unsync required
unsynchronization = TagOptionSingleton.getInstance().isUnsyncTags() && ID3Unsynchronization.requiresUnsynchronization(bodyByteBuffer);
if (isUnsynchronization())
{
bodyByteBuffer = ID3Unsynchronization.unsynchronize(bodyByteBuffer);
logger.info(getLoggingFilename() + ":bodybytebuffer:sizeafterunsynchronisation:" + bodyByteBuffer.length);
}
ByteBuffer headerBuffer = writeHeaderToBuffer(0, bodyByteBuffer.length);
channel.write(headerBuffer);
channel.write(ByteBuffer.wrap(bodyByteBuffer));
}
/**
* For representing the MP3File in an XML Format
*/
public void createStructure()
{
MP3File.getStructureFormatter().openHeadingElement(TYPE_TAG, getIdentifier());
super.createStructureHeader();
//Header
MP3File.getStructureFormatter().openHeadingElement(TYPE_HEADER, "");
MP3File.getStructureFormatter().addElement(TYPE_UNSYNCHRONISATION, this.isUnsynchronization());
| |
| File | Line |
|---|---|
| org\jaudiotagger\tag\id3\ID3v11Tag.java | 516 |
| org\jaudiotagger\tag\id3\ID3v1Tag.java | 917 |
logger.info("Saving ID3v1 tag to file");
byte[] buffer = new byte[TAG_LENGTH];
int i;
String str;
delete(file);
file.seek(file.length());
//Copy the TAGID into new buffer
System.arraycopy(TAG_ID, FIELD_TAGID_POS, buffer, FIELD_TAGID_POS, TAG_ID.length);
int offset = FIELD_TITLE_POS;
if (TagOptionSingleton.getInstance().isId3v1SaveTitle())
{
str = ID3Tags.truncate(title, FIELD_TITLE_LENGTH);
for (i = 0; i < str.length(); i++)
{
buffer[i + offset] = (byte) str.charAt(i);
}
}
offset = FIELD_ARTIST_POS;
if (TagOptionSingleton.getInstance().isId3v1SaveArtist())
{
str = ID3Tags.truncate(artist, FIELD_ARTIST_LENGTH);
for (i = 0; i < str.length(); i++)
{
buffer[i + offset] = (byte) str.charAt(i);
}
}
offset = FIELD_ALBUM_POS;
if (TagOptionSingleton.getInstance().isId3v1SaveAlbum())
{
str = ID3Tags.truncate(album, FIELD_ALBUM_LENGTH);
for (i = 0; i < str.length(); i++)
{
buffer[i + offset] = (byte) str.charAt(i);
}
}
offset = FIELD_YEAR_POS;
if (TagOptionSingleton.getInstance().isId3v1SaveYear())
{
str = ID3Tags.truncate(year, AbstractID3v1Tag.FIELD_YEAR_LENGTH);
| |
| File | Line |
|---|---|
| org\jaudiotagger\audio\ogg\OggVorbisTagReader.java | 226 |
| org\jaudiotagger\audio\ogg\OggVorbisTagReader.java | 313 |
public byte[] convertToVorbisSetupHeaderPacketAndAdditionalPackets(long fileOffsetOfStartingOggPage, RandomAccessFile raf) throws IOException, CannotReadException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
//Seek to specified offset
raf.seek(fileOffsetOfStartingOggPage);
//Read Page
OggPageHeader setupPageHeader = OggPageHeader.read(raf);
//Assume that if multiple packets first packet is VorbisComment and second packet
//is setupheader
if (setupPageHeader.getPacketList().size() > 1)
{
raf.skipBytes(setupPageHeader.getPacketList().get(0).getLength());
}
//Now should be at start of next packet, check this is the vorbis setup header
byte[] b = new byte[VorbisHeader.FIELD_PACKET_TYPE_LENGTH + VorbisHeader.FIELD_CAPTURE_PATTERN_LENGTH];
raf.read(b);
if (!isVorbisSetupHeader(b))
{
throw new CannotReadException("Unable to find setup header(2), unable to write ogg file");
}
//Go back to start of setupheader data
raf.seek(raf.getFilePointer() - (VorbisHeader.FIELD_PACKET_TYPE_LENGTH + VorbisHeader.FIELD_CAPTURE_PATTERN_LENGTH));
//Read data
if (setupPageHeader.getPacketList().size() > 1)
{
b = new byte[setupPageHeader.getPacketList().get(1).getLength()];
raf.read(b);
baos.write(b);
}
else
{
b = new byte[setupPageHeader.getPacketList().get(0).getLength()];
raf.read(b);
baos.write(b);
}
//Return Data
if (!setupPageHeader.isLastPacketIncomplete() || setupPageHeader.getPacketList().size() > 2)
{
logger.info("Setupheader finishes on this page");
| |
| File | Line |
|---|---|
| org\jaudiotagger\tag\lyrics3\FieldFrameBodyIMG.java | 225 |
| org\jaudiotagger\tag\lyrics3\FieldFrameBodyLYR.java | 305 |
str += line.toString();
}
return str;
}
/**
* @param file
* @throws java.io.IOException
*/
public void write(RandomAccessFile file) throws java.io.IOException
{
int size;
int offset = 0;
byte[] buffer = new byte[5];
String str;
size = getSize();
str = Integer.toString(size);
for (int i = 0; i < (5 - str.length()); i++)
{
buffer[i] = (byte) '0';
}
offset += (5 - str.length());
for (int i = 0; i < str.length(); i++)
{
buffer[i + offset] = (byte) str.charAt(i);
}
offset += str.length();
file.write(buffer, 0, 5);
if (size > 0)
{
str = writeString();
buffer = new byte[str.length()];
for (int i = 0; i < str.length(); i++)
{
buffer[i] = (byte) str.charAt(i);
}
file.write(buffer);
}
}
/**
* @param lineString
*/
private void readString(String lineString)
| |
| File | Line |
|---|---|
| org\jaudiotagger\tag\id3\ID3v23Tag.java | 419 |
| org\jaudiotagger\tag\id3\ID3v24Tag.java | 725 |
if ((flags & FileConstants.BIT3) != 0)
{
logger.warning(ErrorMessage.ID3_INVALID_OR_UNKNOWN_FLAG_SET.getMsg(getLoggingFilename(), FileConstants.BIT3));
}
if ((flags & FileConstants.BIT2) != 0)
{
logger.warning(ErrorMessage.ID3_INVALID_OR_UNKNOWN_FLAG_SET.getMsg(getLoggingFilename(), FileConstants.BIT2));
}
if ((flags & FileConstants.BIT1) != 0)
{
logger.warning(ErrorMessage.ID3_INVALID_OR_UNKNOWN_FLAG_SET.getMsg(getLoggingFilename(), FileConstants.BIT1));
}
if ((flags & FileConstants.BIT0) != 0)
{
logger.warning(ErrorMessage.ID3_INVALID_OR_UNKNOWN_FLAG_SET.getMsg(getLoggingFilename(), FileConstants.BIT0));
}
if (isUnsynchronization())
{
logger.info(ErrorMessage.ID3_TAG_UNSYNCHRONIZED.getMsg(getLoggingFilename()));
}
if (extended)
{
logger.info(ErrorMessage.ID3_TAG_EXTENDED.getMsg(getLoggingFilename()));
}
if (experimental)
{
logger.info(ErrorMessage.ID3_TAG_EXPERIMENTAL.getMsg(getLoggingFilename()));
}
| |
| File | Line |
|---|---|
| org\jaudiotagger\tag\id3\ID3v1TagField.java | 156 |
| org\jaudiotagger\tag\vorbiscomment\VorbisCommentTagField.java | 198 |
byte[] contentBytes = getBytes(this.content, "UTF-8");
byte[] b = new byte[4 + idBytes.length + 1 + contentBytes.length];
int length = idBytes.length + 1 + contentBytes.length;
size[3] = (byte) ((length & 0xFF000000) >> 24);
size[2] = (byte) ((length & 0x00FF0000) >> 16);
size[1] = (byte) ((length & 0x0000FF00) >> 8);
size[0] = (byte) (length & 0x000000FF);
int offset = 0;
copy(size, b, offset);
offset += 4;
copy(idBytes, b, offset);
offset += idBytes.length;
b[offset] = (byte) 0x3D;
offset++;// "="
copy(contentBytes, b, offset);
return b;
}
/**
* @see TagField#isBinary()
*/
public boolean isBinary()
{
return false;
}
/**
* @see TagField#isBinary(boolean)
*/
public void isBinary(boolean b)
{
| |
| File | Line |
|---|---|
| org\jaudiotagger\tag\id3\ID3v22Tag.java | 322 |
| org\jaudiotagger\tag\id3\ID3v23Tag.java | 414 |
if ((flags & FileConstants.BIT4) != 0)
{
logger.warning(ErrorMessage.ID3_INVALID_OR_UNKNOWN_FLAG_SET.getMsg(getLoggingFilename(), FileConstants.BIT4));
}
if ((flags & FileConstants.BIT3) != 0)
{
logger.warning(ErrorMessage.ID3_INVALID_OR_UNKNOWN_FLAG_SET.getMsg(getLoggingFilename(), FileConstants.BIT3));
}
if ((flags & FileConstants.BIT2) != 0)
{
logger.warning(ErrorMessage.ID3_INVALID_OR_UNKNOWN_FLAG_SET.getMsg(getLoggingFilename(), FileConstants.BIT2));
}
if ((flags & FileConstants.BIT1) != 0)
{
logger.warning(ErrorMessage.ID3_INVALID_OR_UNKNOWN_FLAG_SET.getMsg(getLoggingFilename(), FileConstants.BIT1));
}
if ((flags & FileConstants.BIT0) != 0)
{
logger.warning(ErrorMessage.ID3_INVALID_OR_UNKNOWN_FLAG_SET.getMsg(getLoggingFilename(), FileConstants.BIT0));
| |
| File | Line |
|---|---|
| org\jaudiotagger\tag\id3\ID3v11Tag.java | 467 |
| org\jaudiotagger\tag\id3\ID3v1Tag.java | 853 |
logger.finer(getLoggingFilename() + ":" + "Reading v1 tag");
//Do single file read of data to cut down on file reads
byte[] dataBuffer = new byte[TAG_LENGTH];
byteBuffer.position(0);
byteBuffer.get(dataBuffer, 0, TAG_LENGTH);
title = Utils.getString(dataBuffer, FIELD_TITLE_POS, FIELD_TITLE_LENGTH, "ISO-8859-1").trim();
Matcher m = AbstractID3v1Tag.endofStringPattern.matcher(title);
if (m.find())
{
title = title.substring(0, m.start());
}
artist = Utils.getString(dataBuffer, FIELD_ARTIST_POS, FIELD_ARTIST_LENGTH, "ISO-8859-1").trim();
m = AbstractID3v1Tag.endofStringPattern.matcher(artist);
if (m.find())
{
artist = artist.substring(0, m.start());
}
album = Utils.getString(dataBuffer, FIELD_ALBUM_POS, FIELD_ALBUM_LENGTH, "ISO-8859-1").trim();
m = AbstractID3v1Tag.endofStringPattern.matcher(album);
| |
| File | Line |
|---|---|
| org\jaudiotagger\audio\ogg\OggVorbisTagReader.java | 493 |
| org\jaudiotagger\audio\ogg\OggVorbisTagReader.java | 556 |
extraPackets = packetList.subList(2, packetList.size());
}
}
//The setup header continues onto the next page
else
{
pageHeader = OggPageHeader.read(raf);
packetList = pageHeader.getPacketList();
while (true)
{
setupHeaderSize += packetList.get(0).getLength();
logger.fine("Adding:" + packetList.get(0).getLength() + " to setup header size");
raf.skipBytes(packetList.get(0).getLength());
if (packetList.size() > 1 || !pageHeader.isLastPacketIncomplete())
{
//done setup size
logger.fine("Found end of setupheader:size:" + setupHeaderSize + "finishes at:" + raf.getFilePointer());
if (packetList.size() > 1)
{
extraPackets = packetList.subList(1, packetList.size());
}
break;
}
//Continues onto another page
pageHeader = OggPageHeader.read(raf);
}
}
}
| |
| File | Line |
|---|---|
| org\jaudiotagger\tag\id3\ID3v23Frame.java | 592 |
| org\jaudiotagger\tag\id3\ID3v24Frame.java | 754 |
if (ID3v24Frames.getInstanceOf().isDiscardIfFileAltered(str))
{
writeFlags |= (byte) MASK_FILE_ALTER_PRESERVATION;
writeFlags &= (byte) ~MASK_TAG_ALTER_PRESERVATION;
}
else
{
writeFlags &= (byte) ~MASK_FILE_ALTER_PRESERVATION;
writeFlags &= (byte) ~MASK_TAG_ALTER_PRESERVATION;
}
}
public void createStructure()
{
MP3File.getStructureFormatter().openHeadingElement(TYPE_FLAGS, "");
MP3File.getStructureFormatter().addElement(TYPE_TAGALTERPRESERVATION, originalFlags & MASK_TAG_ALTER_PRESERVATION);
MP3File.getStructureFormatter().addElement(TYPE_FILEALTERPRESERVATION, originalFlags & MASK_FILE_ALTER_PRESERVATION);
MP3File.getStructureFormatter().addElement(TYPE_READONLY, originalFlags & MASK_READ_ONLY);
MP3File.getStructureFormatter().closeHeadingElement(TYPE_FLAGS);
}
}
/**
* This represents a frame headers Encoding Flags
*/
class EncodingFlags extends AbstractID3v2Frame.EncodingFlags
{
public static final String TYPE_COMPRESSION = "compression";
public static final String TYPE_ENCRYPTION = "encryption";
public static final String TYPE_GROUPIDENTITY = "groupidentity";
public static final String TYPE_FRAMEUNSYNCHRONIZATION = "frameUnsynchronisation";
| |
| File | Line |
|---|---|
| org\jaudiotagger\audio\mp4\atom\Mp4MdhdBox.java | 10 |
| org\jaudiotagger\audio\mp4\atom\Mp4MvhdBox.java | 31 |
public class Mp4MvhdBox extends AbstractMp4Box
{
public static final int VERSION_FLAG_POS = 0;
public static final int OTHER_FLAG_POS = 1;
public static final int CREATED_DATE_SHORT_POS = 4;
public static final int MODIFIED_DATE_SHORT_POS = 8;
public static final int TIMESCALE_SHORT_POS = 12;
public static final int DURATION_SHORT_POS = 16;
public static final int CREATED_DATE_LONG_POS = 4;
public static final int MODIFIED_DATE_LONG_POS = 12;
public static final int TIMESCALE_LONG_POS = 20;
public static final int DURATION_LONG_POS = 24;
public static final int VERSION_FLAG_LENGTH = 1;
public static final int OTHER_FLAG_LENGTH = 3;
public static final int CREATED_DATE_SHORT_LENGTH = 4;
public static final int MODIFIED_DATE_SHORT_LENGTH = 4;
public static final int CREATED_DATE_LONG_LENGTH = 8;
public static final int MODIFIED_DATE_LONG_LENGTH = 8;
public static final int TIMESCALE_LENGTH = 4;
public static final int DURATION_SHORT_LENGTH = 4;
public static final int DURATION_LONG_LENGTH = 8;
private static final int LONG_FORMAT = 1;
private int timeScale;
| |
| File | Line |
|---|---|
| org\jaudiotagger\tag\datatype\PartOfSet.java | 45 |
| org\jaudiotagger\tag\datatype\TextEncodedStringSizeTerminated.java | 52 |
return obj instanceof TextEncodedStringSizeTerminated && super.equals(obj);
}
/**
* Read a 'n' bytes from buffer into a String where n is the framesize - offset
* so thefore cannot use this if there are other objects after it because it has no
* delimiter.
* <p/>
* 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
*/
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException
{
logger.finest("Reading from array from offset:" + offset);
//Get the Specified Decoder
String charSetName = getTextEncodingCharSet();
CharsetDecoder decoder = Charset.forName(charSetName).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.toString());
}
decoder.flush(outBuffer);
outBuffer.flip();
| |
| File | Line |
|---|---|
| org\jaudiotagger\tag\id3\ID3v22Tag.java | 326 |
| org\jaudiotagger\tag\id3\ID3v24Tag.java | 725 |
if ((flags & FileConstants.BIT3) != 0)
{
logger.warning(ErrorMessage.ID3_INVALID_OR_UNKNOWN_FLAG_SET.getMsg(getLoggingFilename(), FileConstants.BIT3));
}
if ((flags & FileConstants.BIT2) != 0)
{
logger.warning(ErrorMessage.ID3_INVALID_OR_UNKNOWN_FLAG_SET.getMsg(getLoggingFilename(), FileConstants.BIT2));
}
if ((flags & FileConstants.BIT1) != 0)
{
logger.warning(ErrorMessage.ID3_INVALID_OR_UNKNOWN_FLAG_SET.getMsg(getLoggingFilename(), FileConstants.BIT1));
}
if ((flags & FileConstants.BIT0) != 0)
{
logger.warning(ErrorMessage.ID3_INVALID_OR_UNKNOWN_FLAG_SET.getMsg(getLoggingFilename(), FileConstants.BIT0));
| |
| File | Line |
|---|---|
| org\jaudiotagger\tag\id3\framebody\FrameBodyTDRC.java | 264 |
| org\jaudiotagger\tag\id3\framebody\FrameBodyTDRC.java | 304 |
super(byteBuffer, frameSize);
//Store the equivalent ID3v23 values in case convert
//Find the date format of the v24Frame
for (int i = 0; i < formatters.size(); i++)
{
try
{
Date d;
synchronized(formatters.get(i))
{
d = formatters.get(i).parse(getText());
}
if (d != null)
{
extractID3v23Formats(d, i);
break;
}
}
//Dont display will occur for each failed format
catch (ParseException e)
{
//Do nothing;
}
catch(NumberFormatException nfe)
{
//Do nothing except log warning because not really expecting this to happen (but it does !)
logger.log(Level.WARNING,"Date Formatter:"+formatters.get(i).toPattern() + "failed to parse:"+getText()+ "with "+nfe.getMessage(),nfe);
}
}
}
| |
| File | Line |
|---|---|
| org\jaudiotagger\audio\ogg\OggVorbisTagReader.java | 272 |
| org\jaudiotagger\audio\ogg\OggVorbisTagReader.java | 368 |
return baos.toByteArray();
}
//The Setupheader extends to the next page, so should be at end of page already
//so carry on reading pages until we get to the end of comment
while (true)
{
logger.info("Reading another page");
OggPageHeader nextPageHeader = OggPageHeader.read(raf);
b = new byte[nextPageHeader.getPacketList().get(0).getLength()];
raf.read(b);
baos.write(b);
//Because there is at least one other packet this means the Setupheader Packet has finished
//on this page so thats all we need and we can return
if (nextPageHeader.getPacketList().size() > 1)
{
logger.info("Setupheader finishes on this page");
return baos.toByteArray();
}
//There is only the Setupheader packet on page if it has completed on this page we can return
if (!nextPageHeader.isLastPacketIncomplete())
{
logger.info("Setupheader finish on Page because this packet is complete");
return baos.toByteArray();
}
}
}
/**
* Calculate the size of the packet data for the comment and setup headers
*
* @param raf
* @return
* @throws CannotReadException
* @throws IOException
*/
public OggVorbisHeaderSizes readOggVorbisHeaderSizes(RandomAccessFile raf) throws CannotReadException, IOException
| |
| File | Line |
|---|---|
| org\jaudiotagger\tag\datatype\PartOfSet.java | 131 |
| org\jaudiotagger\tag\datatype\TextEncodedStringSizeTerminated.java | 138 |
ByteBuffer bb = encoder.encode(CharBuffer.wrap((String) value));
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;
}
/**
* Get the text encoding being used.
* <p/>
* The text encoding is defined by the frame body that the text field belongs to.
*
* @return the text encoding charset
*/
protected String getTextEncodingCharSet()
{
byte textEncoding = this.getBody().getTextEncoding();
String charSetName = TextEncoding.getInstanceOf().getValueForId(textEncoding);
logger.finest("text encoding:" + textEncoding + " charset:" + charSetName);
return charSetName;
}
| |
| File | Line |
|---|---|
| org\jaudiotagger\tag\datatype\PartOfSet.java | 131 |
| org\jaudiotagger\tag\datatype\TextEncodedStringNullTerminated.java | 220 |
ByteBuffer bb = encoder.encode(CharBuffer.wrap((String) value + '\0'));
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;
}
protected String getTextEncodingCharSet()
{
byte textEncoding = this.getBody().getTextEncoding();
String charSetName = TextEncoding.getInstanceOf().getValueForId(textEncoding);
logger.finest("text encoding:" + textEncoding + " charset:" + charSetName);
return charSetName;
}
| |
| File | Line |
|---|---|
| org\jaudiotagger\test\ExtractID3TagFromFile.java | 43 |
| org\jaudiotagger\test\MergeID3AndMP3Files.java | 107 |
}
}
final class MP3FileFilter extends javax.swing.filechooser.FileFilter implements java.io.FileFilter
{
/**
* allows Directories
*/
private final boolean allowDirectories;
/**
* Create a default MP3FileFilter. The allowDirectories field will
* default to false.
*/
public MP3FileFilter()
{
this(false);
}
/**
* Create an MP3FileFilter. If allowDirectories is true, then this filter
* will accept directories as well as mp3 files. If it is false then
* only mp3 files will be accepted.
*
* @param allowDirectories whether or not to accept directories
*/
private MP3FileFilter(final boolean allowDirectories)
{
this.allowDirectories = allowDirectories;
}
/**
* Determines whether or not the file is an mp3 file. If the file is
* a directory, whether or not is accepted depends upon the
* allowDirectories flag passed to the constructor.
*
* @param file the file to test
* @return true if this file or directory should be accepted
*/
public final boolean accept(final File file)
{
return (((file.getName()).toLowerCase().endsWith(".mp3")) || (file.isDirectory() && (this.allowDirectories)));
}
/**
* Returns the Name of the Filter for use in the Chooser Dialog
*
* @return The Description of the Filter
*/
public final String getDescription()
{
return ".mp3 Files";
}
}
public final class DirFilter implements java.io.FileFilter
| |
| File | Line |
|---|---|
| org\jaudiotagger\tag\id3\ID3v11Tag.java | 577 |
| org\jaudiotagger\tag\id3\ID3v1Tag.java | 976 |
logger.info("Saved ID3v1 tag to file");
}
/**
* Create strcutured representation of this item.
*/
public void createStructure()
{
MP3File.getStructureFormatter().openHeadingElement(TYPE_TAG, getIdentifier());
//Header
MP3File.getStructureFormatter().addElement(TYPE_TITLE, this.title);
MP3File.getStructureFormatter().addElement(TYPE_ARTIST, this.artist);
MP3File.getStructureFormatter().addElement(TYPE_ALBUM, this.album);
MP3File.getStructureFormatter().addElement(TYPE_YEAR, this.year);
MP3File.getStructureFormatter().addElement(TYPE_COMMENT, this.comment);
MP3File.getStructureFormatter().addElement(TYPE_GENRE, this.genre);
| |