Package com.tagtraum.audiokern
Class StandardAudioArtwork
- java.lang.Object
-
- com.tagtraum.audiokern.StandardAudioArtwork
-
- All Implemented Interfaces:
AudioArtwork
public class StandardAudioArtwork extends Object implements AudioArtwork
StandardAudioArtwork.- Author:
- Hendrik Schreiber
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.tagtraum.audiokern.AudioArtwork
AudioArtwork.Kind
-
-
Constructor Summary
Constructors Constructor Description StandardAudioArtwork(AudioArtwork audioArtwork, AudioArtwork.Kind kind)Creates a copy of the given artwork while allowing to change the kind.StandardAudioArtwork(Image image, AudioArtwork.Kind kind)Create anAudioArtworkfrom the given image.StandardAudioArtwork(File imageFile, AudioArtwork.Kind kind)Create anAudioArtworkfrom the given file.StandardAudioArtwork(InputStream in, AudioArtwork.Kind kind, URI uri)Create anAudioArtworkfrom the given stream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AudioArtworkcreate(URL imageURL, AudioArtwork.Kind kind)Creates anAudioArtwork.static AudioArtworkcreateLazily(URL imageURL, AudioArtwork.Kind kind)Creates anAudioArtworkobject without actually loading the image.booleanequals(Object o)ImagegetImage()Image object.byte[]getImageData()Encoded image data.AudioArtwork.KindgetKind()Kind of artwork.StringgetMimeType()Mime type.URIgetURI()URI of this artwork.static StringgetUserAgent()inthashCode()static booleanisKindSupportedByAudioFileFormat(AudioFileFormat fileFormat)Indicates, whether differentAudioArtwork.Kinds of artwork are supported by aAudioFileFormat.static voidsetUserAgent(String userAgent)StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.tagtraum.audiokern.AudioArtwork
freeResources
-
-
-
-
Constructor Detail
-
StandardAudioArtwork
public StandardAudioArtwork(AudioArtwork audioArtwork, AudioArtwork.Kind kind)
Creates a copy of the given artwork while allowing to change the kind.- Parameters:
audioArtwork- artworkkind- new kind
-
StandardAudioArtwork
public StandardAudioArtwork(Image image, AudioArtwork.Kind kind)
Create anAudioArtworkfrom the given image.- Parameters:
image- imagekind- kind of artwork
-
StandardAudioArtwork
public StandardAudioArtwork(InputStream in, AudioArtwork.Kind kind, URI uri) throws IOException
Create anAudioArtworkfrom the given stream.- Parameters:
in- streamkind- kind of artwork- Throws:
IOException- if the image file cannot be parsed or does not exist
-
StandardAudioArtwork
public StandardAudioArtwork(File imageFile, AudioArtwork.Kind kind) throws IOException
Create anAudioArtworkfrom the given file.- Parameters:
imageFile- image filekind- kind of artwork- Throws:
IOException- if the image file cannot be parsed or does not exist
-
-
Method Detail
-
getUserAgent
public static String getUserAgent()
-
setUserAgent
public static void setUserAgent(String userAgent)
-
create
public static AudioArtwork create(URL imageURL, AudioArtwork.Kind kind) throws IOException
Creates anAudioArtwork.- Parameters:
imageURL- imageURLkind- kind of artwork the URL contains- Returns:
- artwork
- Throws:
IOException
-
createLazily
public static AudioArtwork createLazily(URL imageURL, AudioArtwork.Kind kind)
Creates anAudioArtworkobject without actually loading the image. The image itself is only loaded, once it is accessed.- Parameters:
imageURL- imageURLkind- kind of artwork the URL contains- Returns:
- lazy artwork
-
getImage
public Image getImage()
Description copied from interface:AudioArtworkImage object.- Specified by:
getImagein interfaceAudioArtwork- Returns:
- image
-
getImageData
public byte[] getImageData()
Description copied from interface:AudioArtworkEncoded image data. Image data that looks exactly like the data usually stored in a file. This means, for a PNG image, this method will return the PNG encoded data.- Specified by:
getImageDatain interfaceAudioArtwork- Returns:
- encoded image data
-
getMimeType
public String getMimeType()
Description copied from interface:AudioArtworkMime type. Usually something likeimage/jpeg.- Specified by:
getMimeTypein interfaceAudioArtwork- Returns:
- mime type, if known. Otherwise
null
-
getKind
public AudioArtwork.Kind getKind()
Description copied from interface:AudioArtworkKind of artwork.- Specified by:
getKindin interfaceAudioArtwork- Returns:
- kind
-
getURI
public URI getURI()
Description copied from interface:AudioArtworkURI of this artwork. May benull, if not available.- Specified by:
getURIin interfaceAudioArtwork- Returns:
- uri or
null
-
isKindSupportedByAudioFileFormat
public static boolean isKindSupportedByAudioFileFormat(AudioFileFormat fileFormat)
Indicates, whether differentAudioArtwork.Kinds of artwork are supported by aAudioFileFormat.- Parameters:
fileFormat- file format- Returns:
- true, if different kinds are supported
-
-