• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ID3v23Tag类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jaudiotagger.tag.id3.ID3v23Tag的典型用法代码示例。如果您正苦于以下问题:Java ID3v23Tag类的具体用法?Java ID3v23Tag怎么用?Java ID3v23Tag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ID3v23Tag类属于org.jaudiotagger.tag.id3包,在下文中一共展示了ID3v23Tag类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createDefaultTag

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
public static Tag createDefaultTag()
{
    if(TagOptionSingleton.getInstance().getID3V2Version()== ID3V2Version.ID3_V24)
    {
        return new ID3v24Tag();
    }
    else if(TagOptionSingleton.getInstance().getID3V2Version()==ID3V2Version.ID3_V23)
    {
        return new ID3v23Tag();
    }
    else if(TagOptionSingleton.getInstance().getID3V2Version()==ID3V2Version.ID3_V22)
    {
        return new ID3v22Tag();
    }
    //Default in case not set somehow
    return new ID3v24Tag();
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:18,代码来源:Dsf.java


示例2: readTag

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
private Tag readTag(RandomAccessFile file, long tagOffset) throws CannotReadException, IOException {
    //Move to start of ID3Tag and read rest of file into ByteBuffer
    file.seek(tagOffset);
    ByteBuffer tagBuffer = Utils.readFileDataIntoBufferLE(file, (int) (file.length() - file.getFilePointer()));

    //Work out ID3 major version
    int majorVersion = tagBuffer.get(AbstractID3v2Tag.FIELD_TAG_MAJOR_VERSION_POS);
    try {
        logger.log(Level.FINE, "Start creating ID3v2 Tag for version: " + majorVersion);
        switch (majorVersion) {
            case ID3v22Tag.MAJOR_VERSION:
                return new ID3v22Tag(tagBuffer, "");
            case ID3v23Tag.MAJOR_VERSION:
                return new ID3v23Tag(tagBuffer, "");
            case ID3v24Tag.MAJOR_VERSION:
                return new ID3v24Tag(tagBuffer, "");
            default:
                logger.log(Level.WARNING, "Unknown major ID3v2 version " + majorVersion + ". Returning an empty ID3v2 Tag.");
                return new ID3v24Tag();
        }
    } catch (TagException e) {
        throw new CannotReadException("Could not create ID3v2 Tag");
    }
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:25,代码来源:DsfAudioFileReader.java


示例3: check

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
@Override
public void check(GenericTag genericTag) {
  if (genericTag == null) {
    return;
  }

  /* get the classes of the source tags */
  Set<Class<? extends Object>> sourceTagClasses = genericTag.getSourceTagClasses();
  assert (sourceTagClasses != null);

  if (!sourceTagClasses.contains(ID3v23Tag.class)) {
    return;
  }

  genericTag.addReport(GenericTagFieldName.OTHER, Messages.getString("NoID3v23TagChecker.0"), null, null, null); //$NON-NLS-1$
}
 
开发者ID:fhuberts,项目名称:musicTreePrograms,代码行数:17,代码来源:NoID3v23TagChecker.java


示例4: testMp3TagConverter

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
@Test(timeout = 8000)
public void testMp3TagConverter() {
  Set<Class<? extends Object>> stc = converter.getSupportedTagClasses();

  assertThat(stc, notNullValue());
  assertThat(Integer.valueOf(stc.size()), equalTo(Integer.valueOf(3)));
  assertThat(Boolean.valueOf(stc.contains(ID3v22Tag.class)), equalTo(Boolean.TRUE));
  assertThat(Boolean.valueOf(stc.contains(ID3v23Tag.class)), equalTo(Boolean.TRUE));
  assertThat(Boolean.valueOf(stc.contains(ID3v24Tag.class)), equalTo(Boolean.TRUE));

  Map<Class<? extends Object>, Set<String>> utfns = converter.getUnknownTagFieldNames();
  assertThat(utfns, notNullValue());
  assertThat(Integer.valueOf(utfns.size()), equalTo(Integer.valueOf(3)));
  Set<String> utfns22 = utfns.get(ID3v22Tag.class);
  assertThat(utfns22, notNullValue());
  assertThat(Integer.valueOf(utfns22.size()), equalTo(Integer.valueOf(0)));
  Set<String> utfns23 = utfns.get(ID3v22Tag.class);
  assertThat(utfns23, notNullValue());
  assertThat(Integer.valueOf(utfns23.size()), equalTo(Integer.valueOf(0)));
  Set<String> utfns24 = utfns.get(ID3v22Tag.class);
  assertThat(utfns24, notNullValue());
  assertThat(Integer.valueOf(utfns24.size()), equalTo(Integer.valueOf(0)));
}
 
开发者ID:fhuberts,项目名称:musicTreePrograms,代码行数:24,代码来源:TestMp3TagConverter.java


示例5: readMp3Tag

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
private static AbstractID3Tag readMp3Tag(File flacFile, boolean v24) {
  AudioFile af;
  try {
    af = AudioFileIO.read(flacFile);
  }
  catch (Throwable e) {
    System.err.println(String.format("Failed to read mp3 file", flacFile.getPath()));
    return null;
  }

  Tag tag = af.getTag();
  if (v24) {
    assert (tag instanceof ID3v24Tag);
    return (ID3v24Tag) tag;
  }

  assert (tag instanceof ID3v23Tag);
  return (ID3v23Tag) tag;
}
 
开发者ID:fhuberts,项目名称:musicTreePrograms,代码行数:20,代码来源:TestFlacToMp3Impl.java


示例6: readTag

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
/**
 * Reads the ID3v2 tag starting at the {@code tagOffset} position in the
 * supplied file.
 *
 * @param fc       the filechannel from which to read
 * @param dsd      the dsd chunk
 * @param fileName
 * @return the read tag or an empty tag if something went wrong. Never
 * <code>null</code>.
 * @throws IOException if cannot read file.
 */
private Tag readTag(FileChannel fc, DsdChunk dsd, String fileName) throws CannotReadException, IOException {
    if (dsd.getMetadataOffset() > 0) {
        fc.position(dsd.getMetadataOffset());
        ID3Chunk id3Chunk = ID3Chunk.readChunk(Utils.readFileDataIntoBufferLE(fc, (int) (fc.size() - fc.position())));
        if (id3Chunk != null) {
            int version = id3Chunk.getDataBuffer().get(AbstractID3v2Tag.FIELD_TAG_MAJOR_VERSION_POS);
            try {
                switch (version) {
                    case ID3v22Tag.MAJOR_VERSION:
                        return new ID3v22Tag(id3Chunk.getDataBuffer(), "");
                    case ID3v23Tag.MAJOR_VERSION:
                        return new ID3v23Tag(id3Chunk.getDataBuffer(), "");
                    case ID3v24Tag.MAJOR_VERSION:
                        return new ID3v24Tag(id3Chunk.getDataBuffer(), "");
                    default:
                        logger.log(Level.WARNING, fileName + " Unknown ID3v2 version " + version + ". Returning an empty ID3v2 Tag.");
                        return null;
                }
            } catch (TagException e) {
                throw new CannotReadException(fileName + " Could not read ID3v2 tag:corruption");
            }
        } else {
            logger.log(Level.WARNING, fileName + " No existing ID3 tag(1)");
            return null;
        }
    } else {
        logger.log(Level.WARNING, fileName + " No existing ID3 tag(2)");
        return null;
    }
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:42,代码来源:DsfFileReader.java


示例7: createDefaultTag

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
/**
 * Create Default Tag
 *
 * @return
 */
@Override
public Tag createDefaultTag() {
    if (TagOptionSingleton.getInstance().getID3V2Version() == ID3V2Version.ID3_V24) {
        return new ID3v24Tag();
    } else if (TagOptionSingleton.getInstance().getID3V2Version() == ID3V2Version.ID3_V23) {
        return new ID3v23Tag();
    } else if (TagOptionSingleton.getInstance().getID3V2Version() == ID3V2Version.ID3_V22) {
        return new ID3v22Tag();
    }
    //Default in case not set somehow
    return new ID3v24Tag();
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:18,代码来源:MP3File.java


示例8: createDefaultMetadataTagsIfMissing

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
private void createDefaultMetadataTagsIfMissing(WavTag tag) {
    if (!tag.isExistingId3Tag()) {
        //Default used by Tag & Rename
        tag.setID3Tag(new ID3v23Tag());
    }
    if (!tag.isExistingInfoTag()) {
        tag.setInfoTag(new WavInfoTag());
    }
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:10,代码来源:WavTagReader.java


示例9: createDefaultTag

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
@Override
public Tag createDefaultTag() {
    if (TagOptionSingleton.getInstance().getID3V2Version() == ID3V2Version.ID3_V24) {
        return new ID3v24Tag();
    } else if (TagOptionSingleton.getInstance().getID3V2Version() == ID3V2Version.ID3_V23) {
        return new ID3v23Tag();
    } else if (TagOptionSingleton.getInstance().getID3V2Version() == ID3V2Version.ID3_V22) {
        return new ID3v22Tag();
    }
    //Default in case not set somehow
    return new ID3v24Tag();
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:13,代码来源:MP3File.java


示例10: convertTag

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
public Tag convertTag(Tag tag, ID3V2Version id3V2Version) {
    if (tag instanceof ID3v24Tag) {
        switch (id3V2Version) {
            case ID3_V22:
                return new ID3v22Tag((ID3v24Tag) tag);
            case ID3_V23:
                return new ID3v23Tag((ID3v24Tag) tag);
            case ID3_V24:
                return tag;
        }
    } else if (tag instanceof ID3v23Tag) {
        switch (id3V2Version) {
            case ID3_V22:
                return new ID3v22Tag((ID3v23Tag) tag);
            case ID3_V23:
                return tag;
            case ID3_V24:
                return new ID3v24Tag((ID3v23Tag) tag);
        }
    } else if (tag instanceof ID3v22Tag) {
        switch (id3V2Version) {
            case ID3_V22:
                return tag;
            case ID3_V23:
                return new ID3v23Tag((ID3v22Tag) tag);
            case ID3_V24:
                return new ID3v24Tag((ID3v22Tag) tag);
        }
    }
    return tag;
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:32,代码来源:MP3File.java


示例11: testCheck_NoId3v24SourceClasses

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
@Test(timeout = 8000)
public void testCheck_NoId3v24SourceClasses() {
  GenericTag tag = TypeUtilsForTests.setupTag("11", "1/1", "Title", "1", "2013", null, null, null, null);
  tag.addSourceTagClass(FlacTag.class);
  tag.addSourceTagClass(ID3v23Tag.class);

  checker.check(tag);

  Map<GenericTagFieldName, List<ProblemReport>> reports = tag.getReports();
  assertThat(Integer.valueOf(reports.size()), equalTo(Integer.valueOf(0)));
}
 
开发者ID:fhuberts,项目名称:musicTreePrograms,代码行数:12,代码来源:TestNoID3v24TagChecker.java


示例12: testCheck_Id3v23SourceClasses

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
@Test(timeout = 8000)
public void testCheck_Id3v23SourceClasses() {
  GenericTag tag = TypeUtilsForTests.setupTag("11", "1/1", "Title", "1", "2013", null, null, null, null);
  tag.addSourceTagClass(FlacTag.class);
  tag.addSourceTagClass(ID3v23Tag.class);

  checker.check(tag);

  Map<GenericTagFieldName, List<ProblemReport>> reports = tag.getReports();
  assertThat(Integer.valueOf(reports.size()), equalTo(Integer.valueOf(1)));
}
 
开发者ID:fhuberts,项目名称:musicTreePrograms,代码行数:12,代码来源:TestNoID3v23TagChecker.java


示例13: Mp3TagConverter

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
/**
 * Constructor
 */
public Mp3TagConverter() {
  supportedTagClasses.add(ID3v22Tag.class);
  supportedTagClasses.add(ID3v23Tag.class);
  supportedTagClasses.add(ID3v24Tag.class);

  unknownTagFieldNames.put(ID3v22Tag.class, new TreeSet<String>());
  unknownTagFieldNames.put(ID3v23Tag.class, new TreeSet<String>());
  unknownTagFieldNames.put(ID3v24Tag.class, new TreeSet<String>());
}
 
开发者ID:fhuberts,项目名称:musicTreePrograms,代码行数:13,代码来源:Mp3TagConverter.java


示例14: testGetSupportedTagClasses

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
@Test(timeout = 8000)
public void testGetSupportedTagClasses() {
  Set<Class<? extends Object>> stc = converter.getSupportedTagClasses();

  assertThat(stc, notNullValue());
  assertThat(Integer.valueOf(stc.size()), equalTo(Integer.valueOf(3)));
  assertThat(Boolean.valueOf(stc.contains(ID3v22Tag.class)), equalTo(Boolean.TRUE));
  assertThat(Boolean.valueOf(stc.contains(ID3v23Tag.class)), equalTo(Boolean.TRUE));
  assertThat(Boolean.valueOf(stc.contains(ID3v24Tag.class)), equalTo(Boolean.TRUE));
}
 
开发者ID:fhuberts,项目名称:musicTreePrograms,代码行数:11,代码来源:TestMp3TagConverter.java


示例15: convertID3Tag

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
/**
 * If using ID3 format convert tag from current version to another as specified by id3V2Version,
 *
 * @return null if no conversion necessary
 */
public AbstractID3v2Tag convertID3Tag(AbstractID3v2Tag tag, ID3V2Version id3V2Version)
{
    if(tag instanceof ID3v24Tag)
    {
        switch(id3V2Version)
        {
            case ID3_V22:
                return new ID3v22Tag((ID3v24Tag)tag);
            case ID3_V23:
                return new ID3v23Tag((ID3v24Tag)tag);
            case ID3_V24:
                return null;
        }
    }
    else if(tag instanceof ID3v23Tag)
    {
        switch(id3V2Version)
        {
            case ID3_V22:
                return new ID3v22Tag((ID3v23Tag)tag);
            case ID3_V23:
                return null;
            case ID3_V24:
                return new ID3v24Tag((ID3v23Tag)tag);
        }
    }
    else if(tag instanceof ID3v22Tag)
    {
        switch(id3V2Version)
        {
            case ID3_V22:
                return null;
            case ID3_V23:
                return new ID3v23Tag((ID3v22Tag)tag);
            case ID3_V24:
                return new ID3v24Tag((ID3v22Tag)tag);
        }
    }
    return null;
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:46,代码来源:AudioFile.java


示例16: save

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
@SuppressWarnings("TryWithIdenticalCatches")
public void save(File fileToSave) throws IOException {
    //Ensure we are dealing with absolute filepaths not relative ones
    File file = fileToSave.getAbsoluteFile();

    logger.config("Saving  : " + file.getPath());

    //Checks before starting write
    precheck(file);

    RandomAccessFile rfile = null;
    try {
        //ID3v2 Tag
        if (TagOptionSingleton.getInstance().isId3v2Save()) {
            if (id3v2tag == null) {
                rfile = new RandomAccessFile(file, "rw");
                (new ID3v24Tag()).delete(rfile);
                (new ID3v23Tag()).delete(rfile);
                (new ID3v22Tag()).delete(rfile);
                logger.config("Deleting ID3v2 tag:" + file.getName());
                rfile.close();
            } else {
                logger.config("Writing ID3v2 tag:" + file.getName());
                final MP3AudioHeader mp3AudioHeader = (MP3AudioHeader) this.getAudioHeader();
                final long mp3StartByte = mp3AudioHeader.getMp3StartByte();
                final long newMp3StartByte = id3v2tag.write(file, mp3StartByte);
                if (mp3StartByte != newMp3StartByte) {
                    logger.config("New mp3 start byte: " + newMp3StartByte);
                    mp3AudioHeader.setMp3StartByte(newMp3StartByte);
                }

            }
        }
        rfile = new RandomAccessFile(file, "rw");

        //Lyrics 3 Tag
        if (TagOptionSingleton.getInstance().isLyrics3Save()) {
            if (lyrics3tag != null) {
                lyrics3tag.write(rfile);
            }
        }
        //ID3v1 tag
        if (TagOptionSingleton.getInstance().isId3v1Save()) {
            logger.config("Processing ID3v1");
            if (id3v1tag == null) {
                logger.config("Deleting ID3v1");
                (new ID3v1Tag()).delete(rfile);
            } else {
                logger.config("Saving ID3v1");
                id3v1tag.write(rfile);
            }
        }
    } catch (FileNotFoundException ex) {
        logger.log(Level.SEVERE, ErrorMessage.GENERAL_WRITE_FAILED_BECAUSE_FILE_NOT_FOUND.getMsg(file.getName()), ex);
        throw ex;
    } catch (IOException iex) {
        logger.log(Level.SEVERE, ErrorMessage.GENERAL_WRITE_FAILED_BECAUSE.getMsg(file.getName(), iex.getMessage()), iex);
        throw iex;
    } catch (RuntimeException re) {
        logger.log(Level.SEVERE, ErrorMessage.GENERAL_WRITE_FAILED_BECAUSE.getMsg(file.getName(), re.getMessage()), re);
        throw re;
    } finally {
        if (rfile != null) {
            rfile.close();
        }
    }
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:68,代码来源:MP3File.java


示例17: onSave

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
@Override
public void onSave() {

	if (currentFile == null) {return;}

	isSaving = true;
	updateTitleAndButtons();
	window.getControlPanel().setLoading(true);

	new Thread() {
		@Override
		public void run() {

			try {

				AudioFile f = AudioFileIO.read(currentFile);
				Tag tag = new ID3v23Tag();
				f.setTag(tag);
				tag.setField(FieldKey.ARTIST, inputModel.getArtist());
				tag.setField(FieldKey.TITLE, inputModel.getTitle());
				tag.setField(FieldKey.ALBUM, inputModel.getAlbum());

				if (!inputModel.getYear().isEmpty()) {tag.setField(FieldKey.YEAR, inputModel.getYear());}
				tag.setField(FieldKey.GENRE, inputModel.getGenre());

				if (inputModel.getCover() != null) {
					final int TYPE_FRONT_COVER = 3;
					Artwork a = ArtworkFactory.getNew();
					a.setBinaryData(inputModel.getCover());
					a.setPictureType(TYPE_FRONT_COVER);
					//a.setMimeType("JPG");
					tag.setField(a);
				}

				f.commit();

				// mark model as saved
				inputModel.setChanged(false);	
				System.out.println("saved");	

			} catch (Exception e) {e.printStackTrace(); showError(e);}

			isSaving = false;
			updateTitleAndButtons();
			window.getControlPanel().setLoading(false);

		}
	}.start();

}
 
开发者ID:k-a-z-u,项目名称:DragTag,代码行数:51,代码来源:Controller.java


示例18: check

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
@Override
public void check(GenericTag genericTag) {
  if (genericTag == null) {
    return;
  }

  /* get the classes of the source tags */
  Set<Class<? extends Object>> sourceTagClasses = genericTag.getSourceTagClasses();
  assert (sourceTagClasses != null);

  /* exit when there are no source classes */
  if (sourceTagClasses.isEmpty()) {
    return;
  }

  /* only check mp3 files */
  if (!(sourceTagClasses.contains(ID3v24Tag.class) || sourceTagClasses.contains(ID3v23Tag.class)
      || sourceTagClasses.contains(ID3v22Tag.class) || sourceTagClasses.contains(ID3v11Tag.class)
      || sourceTagClasses.contains(ID3v1Tag.class))) {
    return;
  }

  /* get all fields */
  Map<GenericTagFieldName, Map<String, Set<String>>> fields = genericTag.getFields();
  assert (fields != null);

  for (Entry<GenericTagFieldName, Map<String, Set<String>>> entry : fields.entrySet()) {
    GenericTagFieldName fieldName = entry.getKey();

    /* only evaluate the mentioned fields */
    if (!(GenericTagFieldName.ALBUMTITLE.equals(fieldName) || GenericTagFieldName.TRACKARTIST.equals(fieldName)
        || GenericTagFieldName.TRACKTITLE.equals(fieldName) || GenericTagFieldName.ALBUMARTIST.equals(fieldName))) {
      continue;
    }

    /* get all values for the current tag field name */
    Map<String, Set<String>> valueNameMap = entry.getValue();

    if ((valueNameMap == null) || valueNameMap.isEmpty()) {
      continue;
    }

    for (String value : valueNameMap.keySet()) {
      if (value.length() == ID3V1_MAX_FIELD_LENGTH) {
        genericTag.addReport(fieldName, Messages.getString("ID3v1TagChecker.0"), value, positionMarkers, null); //$NON-NLS-1$
      }
    }
  }
}
 
开发者ID:fhuberts,项目名称:musicTreePrograms,代码行数:50,代码来源:ID3v1TagChecker.java


示例19: checkFields

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
private void checkFields(int version, GenericTag genericTag, String[] idNames, String[] idExpectedValues,
    GenericTagFieldName[] genericids, String[] unknowns) {
  assert (idNames.length == idExpectedValues.length);
  assert (idNames.length == genericids.length);

  Class<? extends Object> clazz;
  switch (version) {
    case 24:
      clazz = ID3v24Tag.class;
      break;
    case 23:
      clazz = ID3v23Tag.class;
      break;
    case 22:
      clazz = ID3v22Tag.class;
      break;
    default:
      throw new IllegalArgumentException("Wrong version " + version);
  }

  Map<GenericTagFieldName, Map<String, Set<String>>> fields = genericTag.getFields();
  assertThat(fields, notNullValue());
  assertThat(Integer.valueOf(fields.size()), equalTo(Integer.valueOf(idNames.length)));

  for (int i = 0; i < idNames.length; i++) {
    String idName = idNames[i];
    String idExpectedValue = idExpectedValues[i];
    GenericTagFieldName genericid = genericids[i];

    Map<String, Set<String>> valueNameMap = fields.get(genericid);
    assertThat(valueNameMap, notNullValue());
    assertThat(Integer.valueOf(valueNameMap.size()), equalTo(Integer.valueOf(1)));

    Set<String> tagIdNames = valueNameMap.get(idExpectedValue);
    assertThat(idNames, notNullValue());
    assertThat(Integer.valueOf(tagIdNames.size()), equalTo(Integer.valueOf(1)));
    assertThat(Boolean.valueOf(tagIdNames.contains(idName)), equalTo(Boolean.TRUE));
  }

  /* check unknowns */
  Map<Class<? extends Object>, Set<String>> utfns = converter.getUnknownTagFieldNames();
  assertThat(utfns, notNullValue());
  assertThat(Integer.valueOf(utfns.size()), equalTo(Integer.valueOf(3)));
  Set<String> utfns1 = utfns.get(clazz);
  assertThat(utfns1, notNullValue());
  assertThat(Integer.valueOf(utfns1.size()), equalTo(Integer.valueOf(unknowns.length)));
  for (String unknown : unknowns) {
    assertThat(Boolean.valueOf(utfns1.contains(unknown)), equalTo(Boolean.TRUE));
  }
}
 
开发者ID:fhuberts,项目名称:musicTreePrograms,代码行数:51,代码来源:TestMp3TagConverter.java


示例20: testConvert_AllFields23

import org.jaudiotagger.tag.id3.ID3v23Tag; //导入依赖的package包/类
@Test(timeout = 8000)
public void testConvert_AllFields23() throws FieldDataInvalidException {
  GenericTag genericTag = new GenericTag();

  String[] idNames = {
      "TPOS",
      "TCON",
      "TOPE",
      "TALB",
      "TRCK",
      "TYER",
      "TPE1",
      "TIT2",
      "TSSE"
  };

  String[] idValues = {
      "ALBUMDISCNUMBER value",
      "ALBUMGENRE value",
      "ALBUMARTIST value",
      "ALBUMTITLE value",
      "14/28",
      "ALBUMYEAR value",
      "TRACKARTIST value",
      "TRACKTITLE value",
      "THISFIELDDOESNTEXIST value"
  };

  String[] idNamesCheck = {
      "TPOS",
      "TCON",
      "TOPE",
      "TALB",
      "TRCK",
      "TRCK",
      "TYER",
      "TPE1",
      "TIT2",
      "TSSE"
  };

  String[] idExpectedValues = {
      "ALBUMDISCNUMBER value",
      "ALBUMGENRE value",
      "ALBUMARTIST value",
      "ALBUMTITLE value",
      "28",
      "14",
      "ALBUMYEAR value",
      "TRACKARTIST value",
      "TRACKTITLE value",
      "THISFIELDDOESNTEXIST value"
  };

  GenericTagFieldName[] genericids = {
      GenericTagFieldName.ALBUMDISCNUMBER,
      GenericTagFieldName.ALBUMGENRE,
      GenericTagFieldName.ALBUMARTIST,
      GenericTagFieldName.ALBUMTITLE,
      GenericTagFieldName.ALBUMTOTALTRACKS,
      GenericTagFieldName.TRACKNUMBER,
      GenericTagFieldName.ALBUMYEAR,
      GenericTagFieldName.TRACKARTIST,
      GenericTagFieldName.TRACKTITLE,
      GenericTagFieldName.OTHER
  };

  String[] unknowns = {
      "TSSE"
  };

  ID3v23Tag tag = (ID3v23Tag) setupTag(23, idNames, idValues);

  boolean result = converter.convert(genericTag, tag);

  assertThat(Boolean.valueOf(result), equalTo(Boolean.TRUE));
  checkFields(23, genericTag, idNamesCheck, idExpectedValues, genericids, unknowns);
}
 
开发者ID:fhuberts,项目名称:musicTreePrograms,代码行数:79,代码来源:TestMp3TagConverter.java



注:本文中的org.jaudiotagger.tag.id3.ID3v23Tag类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NamespaceContextImpl类代码示例发布时间:2022-05-22
下一篇:
Java ContainerLaunchContextProtoOrBuilder类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap