当前位置: 首页>>代码示例>>Java>>正文


Java Artwork.getBinaryData方法代码示例

本文整理汇总了Java中org.jaudiotagger.tag.images.Artwork.getBinaryData方法的典型用法代码示例。如果您正苦于以下问题:Java Artwork.getBinaryData方法的具体用法?Java Artwork.getBinaryData怎么用?Java Artwork.getBinaryData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jaudiotagger.tag.images.Artwork的用法示例。


在下文中一共展示了Artwork.getBinaryData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getImageInputStreamWithType

import org.jaudiotagger.tag.images.Artwork; //导入方法依赖的package包/类
/**
 * Returns an input stream to the image in the given file.  If the file is an audio file,
 * the embedded album art is returned. In addition returns the mime type
 */
private Pair<InputStream, String> getImageInputStreamWithType(File file) throws IOException {
    InputStream is;
    String mimeType;
    if (jaudiotaggerParser.isApplicable(file)) {
        LOG.trace("Using Jaudio Tagger for reading artwork from {}", file);
        MediaFile mediaFile = mediaFileService.getMediaFile(file);
        Artwork artwork;
        try {
            LOG.trace("Reading artwork from file {}", mediaFile);
            artwork = jaudiotaggerParser.getArtwork(mediaFile);
        } catch (Exception e) {
            LOG.debug("Could not read artwork from file {}", mediaFile);
            throw new RuntimeException(e);
        }
        is = new ByteArrayInputStream(artwork.getBinaryData());
        mimeType = artwork.getMimeType();
    } else {
        is =  new FileInputStream(file);
        mimeType = StringUtil.getMimeType(FilenameUtils.getExtension(file.getName()));
    }
    return Pair.of(is, mimeType);
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:27,代码来源:CoverArtController.java

示例2: createMetadataBlockDataPicture

import org.jaudiotagger.tag.images.Artwork; //导入方法依赖的package包/类
/**
 * Create MetadataBlockPicture field, this is the preferred way of storing artwork in VorbisComment tag now but
 * has to be base encoded to be stored in VorbisComment
 *
 * @return MetadataBlockDataPicture
 */
private MetadataBlockDataPicture createMetadataBlockDataPicture(Artwork artwork) throws FieldDataInvalidException {
    if (artwork.isLinked()) {
        return new MetadataBlockDataPicture(
                Utils.getDefaultBytes(artwork.getImageUrl(), TextEncoding.CHARSET_ISO_8859_1),
                artwork.getPictureType(),
                MetadataBlockDataPicture.IMAGE_IS_URL,
                "",
                0,
                0,
                0,
                0);
    } else {
        if (!artwork.setImageFromData()) {
            throw new FieldDataInvalidException("Unable to create MetadataBlockDataPicture from buffered");
        }
        return new MetadataBlockDataPicture(artwork.getBinaryData(),
                artwork.getPictureType(),
                artwork.getMimeType(),
                artwork.getDescription(),
                artwork.getWidth(),
                artwork.getHeight(),
                0,
                0);
    }
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:32,代码来源:VorbisCommentTag.java

示例3: createMetadataBlockDataPicture

import org.jaudiotagger.tag.images.Artwork; //导入方法依赖的package包/类
private MetadataBlockDataPicture createMetadataBlockDataPicture(Artwork artwork) throws FieldDataInvalidException {
    if (artwork.isLinked()) {
        return new MetadataBlockDataPicture(
                artwork.getImageUrl().getBytes(StandardCharsets.ISO_8859_1),
                artwork.getPictureType(),
                MetadataBlockDataPicture.IMAGE_IS_URL,
                "",
                0,
                0,
                0,
                0);
    } else {
        if (!artwork.setImageFromData()) {
            throw new FieldDataInvalidException("Unable to create MetadataBlockDataPicture from buffered");
        }
        return new MetadataBlockDataPicture(artwork.getBinaryData(),
                artwork.getPictureType(),
                artwork.getMimeType(),
                artwork.getDescription(),
                artwork.getWidth(),
                artwork.getHeight(),
                0,
                0);
    }
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:26,代码来源:VorbisCommentTag.java

示例4: createField

import org.jaudiotagger.tag.images.Artwork; //导入方法依赖的package包/类
public TagField createField(Artwork artwork) throws FieldDataInvalidException {
    if (artwork.isLinked()) {
        return new MetadataBlockDataPicture(
                artwork.getImageUrl().getBytes(StandardCharsets.ISO_8859_1),
                artwork.getPictureType(),
                MetadataBlockDataPicture.IMAGE_IS_URL,
                "",
                0,
                0,
                0,
                0);
    } else {
        if (!artwork.setImageFromData()) {
            throw new FieldDataInvalidException("Unable to createField buffered image from the image");
        }

        return new MetadataBlockDataPicture(artwork.getBinaryData(),
                artwork.getPictureType(),
                artwork.getMimeType(),
                artwork.getDescription(),
                artwork.getWidth(),
                artwork.getHeight(),
                0,
                0);
    }
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:27,代码来源:FlacTag.java

示例5: getAlbumArt

import org.jaudiotagger.tag.images.Artwork; //导入方法依赖的package包/类
@Nullable
protected Bitmap getAlbumArt() {
    try {
        Artwork artworkTag = getAudioFile(songPaths.get(0)).getTagOrCreateAndSetDefault().getFirstArtwork();
        if (artworkTag != null) {
            byte[] artworkBinaryData = artworkTag.getBinaryData();
            return BitmapFactory.decodeByteArray(artworkBinaryData, 0, artworkBinaryData.length);
        }
        return null;
    } catch (Exception ignored) {
        return null;
    }
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:14,代码来源:AbsTagEditorActivity.java

示例6: createMetadataBlockDataPicture

import org.jaudiotagger.tag.images.Artwork; //导入方法依赖的package包/类
/**
  * Create MetadataBlockPicture field, this is the preferred way of storing artwork in VorbisComment tag now but
  * has to be base encoded to be stored in VorbisComment
  *
  * @return MetadataBlockDataPicture
*/
 private MetadataBlockDataPicture createMetadataBlockDataPicture(Artwork artwork) throws FieldDataInvalidException
 {
     if(artwork.isLinked())
     {
         return new MetadataBlockDataPicture(
                 artwork.getImageUrl().getBytes(StandardCharsets.ISO_8859_1),
                 artwork.getPictureType(),
                 MetadataBlockDataPicture.IMAGE_IS_URL,
                 "",
                 0,
                 0,
                 0,
                 0);
     }
     else
     {
         if(!artwork.setImageFromData())
         {
             throw new FieldDataInvalidException("Unable to create MetadataBlockDataPicture from buffered");
         }
         return new MetadataBlockDataPicture(artwork.getBinaryData(),
                 artwork.getPictureType(),
                 artwork.getMimeType(),
                 artwork.getDescription(),
                 artwork.getWidth(),
                 artwork.getHeight(),
                 0,
                 0);
     }
 }
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:37,代码来源:VorbisCommentTag.java

示例7: createField

import org.jaudiotagger.tag.images.Artwork; //导入方法依赖的package包/类
/**
 * Create artwork field
 *
 * @return
 */
public TagField createField(Artwork artwork) throws FieldDataInvalidException
{
    if(artwork.isLinked())
    {
        return new MetadataBlockDataPicture(
                artwork.getImageUrl().getBytes(StandardCharsets.ISO_8859_1),
                artwork.getPictureType(),
                MetadataBlockDataPicture.IMAGE_IS_URL,
                "",
                0,
                0,
                0,
                0);
    }
    else
    {
        if(!artwork.setImageFromData())
        {
            throw new FieldDataInvalidException("Unable to createField buffered image from the image");
        }

        return new MetadataBlockDataPicture(artwork.getBinaryData(),
                artwork.getPictureType(),
                artwork.getMimeType(),
                artwork.getDescription(),
                artwork.getWidth(),
                artwork.getHeight(),
                0,
                0);
    }
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:37,代码来源:FlacTag.java

示例8: createField

import org.jaudiotagger.tag.images.Artwork; //导入方法依赖的package包/类
/**
 * Create artwork field
 *
 * @return
 */
public TagField createField(Artwork artwork) throws FieldDataInvalidException {
    if (artwork.isLinked()) {
        return new MetadataBlockDataPicture(
                Utils.getDefaultBytes(artwork.getImageUrl(), TextEncoding.CHARSET_ISO_8859_1),
                artwork.getPictureType(),
                MetadataBlockDataPicture.IMAGE_IS_URL,
                "",
                0,
                0,
                0,
                0);
    } else {
        if (!artwork.setImageFromData()) {
            throw new FieldDataInvalidException("Unable to createField buffered image from the image");
        }

        return new MetadataBlockDataPicture(artwork.getBinaryData(),
                artwork.getPictureType(),
                artwork.getMimeType(),
                artwork.getDescription(),
                artwork.getWidth(),
                artwork.getHeight(),
                0,
                0);
    }
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:32,代码来源:FlacTag.java

示例9: createMetadataBlockDataPicture

import org.jaudiotagger.tag.images.Artwork; //导入方法依赖的package包/类
/**
  * Create MetadataBlockPicture field, this is the preferred way of storing artwork in VorbisComment tag now but
  * has to be base encoded to be stored in VorbisComment
  *
  * @return MetadataBlockDataPicture
*/
 private MetadataBlockDataPicture createMetadataBlockDataPicture(Artwork artwork) throws FieldDataInvalidException
 {
     if(artwork.isLinked())
     {
          return new MetadataBlockDataPicture(
                 Utils.getDefaultBytes(artwork.getImageUrl(), TextEncoding.CHARSET_ISO_8859_1),
                 artwork.getPictureType(),
                 MetadataBlockDataPicture.IMAGE_IS_URL,
                 "",
                 0,
                 0,
                 0,
                 0);
     }
     else
     {
         if(!artwork.setImageFromData())
         {
             throw new FieldDataInvalidException("Unable to create MetadataBlockDataPicture from buffered");
         }
         return new MetadataBlockDataPicture(artwork.getBinaryData(),
                 artwork.getPictureType(),
                 artwork.getMimeType(),
                 artwork.getDescription(),
                 artwork.getWidth(),
                 artwork.getHeight(),
                 0,
                 0);
     }
 }
 
开发者ID:Dynious,项目名称:SoundsCool,代码行数:37,代码来源:VorbisCommentTag.java

示例10: createField

import org.jaudiotagger.tag.images.Artwork; //导入方法依赖的package包/类
/**
 * Create artwork field
 *
 * @return
 */
public TagField createField(Artwork artwork) throws FieldDataInvalidException
{
    if(artwork.isLinked())
    {
         return new MetadataBlockDataPicture(
                Utils.getDefaultBytes(artwork.getImageUrl(), TextEncoding.CHARSET_ISO_8859_1),
                artwork.getPictureType(),
                MetadataBlockDataPicture.IMAGE_IS_URL,
                "",
                0,
                0,
                0,
                0);
    }
    else
    {
        if(!artwork.setImageFromData())
        {
            throw new FieldDataInvalidException("Unable to createField buffered image from the image");
        }

        return new MetadataBlockDataPicture(artwork.getBinaryData(),
                artwork.getPictureType(),
                artwork.getMimeType(),
                artwork.getDescription(),
                artwork.getWidth(),
                artwork.getHeight(),
                0,
                0);
    }
}
 
开发者ID:Dynious,项目名称:SoundsCool,代码行数:37,代码来源:FlacTag.java

示例11: createField

import org.jaudiotagger.tag.images.Artwork; //导入方法依赖的package包/类
public AsfTagCoverField createField(final Artwork artwork) {
    return new AsfTagCoverField(artwork.getBinaryData(), artwork.getPictureType(), artwork.getDescription(), artwork.getMimeType());
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:4,代码来源:AsfTag.java

示例12: createField

import org.jaudiotagger.tag.images.Artwork; //导入方法依赖的package包/类
public TagField createField(Artwork artwork) throws FieldDataInvalidException {
    return new Mp4TagCoverField(artwork.getBinaryData());
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:4,代码来源:Mp4Tag.java

示例13: artworkToBitmap

import org.jaudiotagger.tag.images.Artwork; //导入方法依赖的package包/类
/**
 * Converts an image from an Artwork object to a Bitmap object. The supplied dimensions are used
 * to optimise the image so that memory usage is reduced without distortion or degradation. If
 * either dimension parameter is less than or equal to 0, then the full unoptimised cover art is
 * returned.
 *
 * @param artwork
 * 		the artwork to convert
 * @param width
 * 		the desired width of the image
 * @param height
 * 		the desired height of the image
 * @return the converted image
 */
private static Bitmap artworkToBitmap(final Artwork artwork, final int width, final int
		height) {
	final byte[] rawBitmapArray = (artwork == null) ? null : artwork.getBinaryData();

	if (rawBitmapArray == null) {
		return null;
	} else if (width == 0 || height == 0) {
		return BitmapFactory.decodeByteArray(rawBitmapArray, 0, rawBitmapArray.length);
	} else {
		return BitmapEfficiencyHelper.decodeByteArray(rawBitmapArray, width, height);
	}
}
 
开发者ID:MatthewTamlin,项目名称:Mixtape,代码行数:27,代码来源:Id3Util.java

示例14: createField

import org.jaudiotagger.tag.images.Artwork; //导入方法依赖的package包/类
/**
 * Creates an {@link AsfTagCoverField} from given artwork
 *
 * @param artwork artwork to create a ASF field from.
 * @return ASF field capable of storing artwork.
 */
public AsfTagCoverField createField(final Artwork artwork)
{
    return new AsfTagCoverField(artwork.getBinaryData(), artwork.getPictureType(), artwork.getDescription(), artwork.getMimeType());
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:11,代码来源:AsfTag.java

示例15: createField

import org.jaudiotagger.tag.images.Artwork; //导入方法依赖的package包/类
/**
 * Create artwork field
 *    
 * @return
 */
public TagField createField(Artwork artwork) throws FieldDataInvalidException
{
    return new Mp4TagCoverField(artwork.getBinaryData());
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:10,代码来源:Mp4Tag.java


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