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 anAudioArtwork
from the given image.StandardAudioArtwork(File imageFile, AudioArtwork.Kind kind)
Create anAudioArtwork
from the given file.StandardAudioArtwork(InputStream in, AudioArtwork.Kind kind, URI uri)
Create anAudioArtwork
from the given stream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AudioArtwork
create(URL imageURL, AudioArtwork.Kind kind)
Creates anAudioArtwork
.static AudioArtwork
createLazily(URL imageURL, AudioArtwork.Kind kind)
Creates anAudioArtwork
object without actually loading the image.boolean
equals(Object o)
Image
getImage()
Image object.byte[]
getImageData()
Encoded image data.AudioArtwork.Kind
getKind()
Kind of artwork.String
getMimeType()
Mime type.URI
getURI()
URI of this artwork.static String
getUserAgent()
int
hashCode()
static boolean
isKindSupportedByAudioFileFormat(AudioFileFormat fileFormat)
Indicates, whether differentAudioArtwork.Kind
s of artwork are supported by aAudioFileFormat
.static void
setUserAgent(String userAgent)
String
toString()
-
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 anAudioArtwork
from the given image.- Parameters:
image
- imagekind
- kind of artwork
-
StandardAudioArtwork
public StandardAudioArtwork(InputStream in, AudioArtwork.Kind kind, URI uri) throws IOException
Create anAudioArtwork
from 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 anAudioArtwork
from 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 anAudioArtwork
object 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:AudioArtwork
Image object.- Specified by:
getImage
in interfaceAudioArtwork
- Returns:
- image
-
getImageData
public byte[] getImageData()
Description copied from interface:AudioArtwork
Encoded 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:
getImageData
in interfaceAudioArtwork
- Returns:
- encoded image data
-
getMimeType
public String getMimeType()
Description copied from interface:AudioArtwork
Mime type. Usually something likeimage/jpeg
.- Specified by:
getMimeType
in interfaceAudioArtwork
- Returns:
- mime type, if known. Otherwise
null
-
getKind
public AudioArtwork.Kind getKind()
Description copied from interface:AudioArtwork
Kind of artwork.- Specified by:
getKind
in interfaceAudioArtwork
- Returns:
- kind
-
getURI
public URI getURI()
Description copied from interface:AudioArtwork
URI of this artwork. May benull
, if not available.- Specified by:
getURI
in interfaceAudioArtwork
- Returns:
- uri or
null
-
isKindSupportedByAudioFileFormat
public static boolean isKindSupportedByAudioFileFormat(AudioFileFormat fileFormat)
Indicates, whether differentAudioArtwork.Kind
s of artwork are supported by aAudioFileFormat
.- Parameters:
fileFormat
- file format- Returns:
- true, if different kinds are supported
-
-