本文整理汇总了Java中org.jaudiotagger.tag.id3.ID3v23Tag类的典型用法代码示例。如果您正苦于以下问题:Java ID3v23Tag类的具体用法?Java ID3v23Tag怎么用?Java ID3v23Tag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ID3v23Tag类属于org.jaudiotagger.tag.id3包,在下文中一共展示了ID3v23Tag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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");
}
}
示例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$
}
示例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)));
}
示例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;
}
示例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;
}
}
示例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();
}
示例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());
}
}
示例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();
}
示例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;
}
示例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)));
}
示例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)));
}
示例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>());
}
示例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));
}
示例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;
}