org.jaudiotagger.tag.id3.valuepair
Class ImageFormats

java.lang.Object
  extended by org.jaudiotagger.tag.id3.valuepair.ImageFormats

public class ImageFormats
extends java.lang.Object

Represents common image formats support by ID3 and provides a mapping between the format field supported in ID3v22 and the mimetype field supported by ID3v23/ID3v24. Note only JPG and PNG are mentioned specifically in the ID3 v22 Spec but it only says 'Image Format is preferably PNG or JPG' , not mandatory. In the jaudiotagger library we also consider GIF as a portable format, and we recognise BMP,PDF and TIFF but do not consider these formats as portable.


Field Summary
private static java.util.Map<java.lang.String,java.lang.String> imageFormatsToMimeType
           
private static java.util.Map<java.lang.String,java.lang.String> imageMimeTypeToFormat
           
static java.lang.String MIME_TYPE_BMP
           
static java.lang.String MIME_TYPE_GIF
           
static java.lang.String MIME_TYPE_JPEG
           
static java.lang.String MIME_TYPE_JPG
          Sometimes this is used for jpg instead :or have I made this up
static java.lang.String MIME_TYPE_PDF
           
static java.lang.String MIME_TYPE_PICT
           
static java.lang.String MIME_TYPE_PNG
           
static java.lang.String MIME_TYPE_TIFF
           
static java.lang.String V22_BMP_FORMAT
           
static java.lang.String V22_GIF_FORMAT
           
static java.lang.String V22_JPG_FORMAT
           
static java.lang.String V22_PDF_FORMAT
           
static java.lang.String V22_PIC_FORMAT
           
static java.lang.String V22_PNG_FORMAT
           
static java.lang.String V22_TIF_FORMAT
           
 
Constructor Summary
ImageFormats()
           
 
Method Summary
static boolean binaryDataIsBmpFormat(byte[] data)
          Is this binary data a bmp image
static boolean binaryDataIsGifFormat(byte[] data)
          Is this binary data a gif image
static boolean binaryDataIsJpgFormat(byte[] data)
          Is this binary data a jpg image
static boolean binaryDataIsPdfFormat(byte[] data)
          Is this binary data a pdf image Details at http://en.wikipedia.org/wiki/Magic_number_%28programming%29
static boolean binaryDataIsPngFormat(byte[] data)
          Is this binary data a png image
static boolean binaryDataIsTiffFormat(byte[] data)
          is this binary data a tiff image Details at http://en.wikipedia.org/wiki/Magic_number_%28programming%29
static java.lang.String getFormatForMimeType(java.lang.String mimeType)
          Get v2.2 format from v2.3 mimetype
static java.lang.String getMimeTypeForBinarySignature(byte[] data)
           
static java.lang.String getMimeTypeForFormat(java.lang.String format)
          Get v2.3 mimetype from v2.2 format
static boolean isPortableFormat(byte[] data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

V22_JPG_FORMAT

public static final java.lang.String V22_JPG_FORMAT
See Also:
Constant Field Values

V22_PNG_FORMAT

public static final java.lang.String V22_PNG_FORMAT
See Also:
Constant Field Values

V22_GIF_FORMAT

public static final java.lang.String V22_GIF_FORMAT
See Also:
Constant Field Values

V22_BMP_FORMAT

public static final java.lang.String V22_BMP_FORMAT
See Also:
Constant Field Values

V22_TIF_FORMAT

public static final java.lang.String V22_TIF_FORMAT
See Also:
Constant Field Values

V22_PDF_FORMAT

public static final java.lang.String V22_PDF_FORMAT
See Also:
Constant Field Values

V22_PIC_FORMAT

public static final java.lang.String V22_PIC_FORMAT
See Also:
Constant Field Values

MIME_TYPE_JPEG

public static final java.lang.String MIME_TYPE_JPEG
See Also:
Constant Field Values

MIME_TYPE_PNG

public static final java.lang.String MIME_TYPE_PNG
See Also:
Constant Field Values

MIME_TYPE_GIF

public static final java.lang.String MIME_TYPE_GIF
See Also:
Constant Field Values

MIME_TYPE_BMP

public static final java.lang.String MIME_TYPE_BMP
See Also:
Constant Field Values

MIME_TYPE_TIFF

public static final java.lang.String MIME_TYPE_TIFF
See Also:
Constant Field Values

MIME_TYPE_PDF

public static final java.lang.String MIME_TYPE_PDF
See Also:
Constant Field Values

MIME_TYPE_PICT

public static final java.lang.String MIME_TYPE_PICT
See Also:
Constant Field Values

MIME_TYPE_JPG

public static final java.lang.String MIME_TYPE_JPG
Sometimes this is used for jpg instead :or have I made this up

See Also:
Constant Field Values

imageFormatsToMimeType

private static java.util.Map<java.lang.String,java.lang.String> imageFormatsToMimeType

imageMimeTypeToFormat

private static java.util.Map<java.lang.String,java.lang.String> imageMimeTypeToFormat
Constructor Detail

ImageFormats

public ImageFormats()
Method Detail

getMimeTypeForFormat

public static java.lang.String getMimeTypeForFormat(java.lang.String format)
Get v2.3 mimetype from v2.2 format

Parameters:
format -
Returns:

getFormatForMimeType

public static java.lang.String getFormatForMimeType(java.lang.String mimeType)
Get v2.2 format from v2.3 mimetype

Parameters:
mimeType -
Returns:

binaryDataIsPngFormat

public static boolean binaryDataIsPngFormat(byte[] data)
Is this binary data a png image

Parameters:
data -
Returns:
true if binary data matches expected header for a png

binaryDataIsJpgFormat

public static boolean binaryDataIsJpgFormat(byte[] data)
Is this binary data a jpg image

Parameters:
data -
Returns:
true if binary data matches expected header for a jpg Some details http://www.obrador.com/essentialjpeg/headerinfo.htm

binaryDataIsGifFormat

public static boolean binaryDataIsGifFormat(byte[] data)
Is this binary data a gif image

Parameters:
data -
Returns:
true if binary data matches expected header for a gif

binaryDataIsBmpFormat

public static boolean binaryDataIsBmpFormat(byte[] data)
Is this binary data a bmp image

Parameters:
data -
Returns:
true if binary data matches expected header for a bmp

binaryDataIsPdfFormat

public static boolean binaryDataIsPdfFormat(byte[] data)
Is this binary data a pdf image Details at http://en.wikipedia.org/wiki/Magic_number_%28programming%29

Parameters:
data -
Returns:
true if binary data matches expected header for a pdf

binaryDataIsTiffFormat

public static boolean binaryDataIsTiffFormat(byte[] data)
is this binary data a tiff image Details at http://en.wikipedia.org/wiki/Magic_number_%28programming%29

Parameters:
data -
Returns:
true if binary data matches expected header for a tiff

isPortableFormat

public static boolean isPortableFormat(byte[] data)
Parameters:
data -
Returns:
true if the image format is a portable format recognised across operating systems

getMimeTypeForBinarySignature

public static java.lang.String getMimeTypeForBinarySignature(byte[] data)
Parameters:
data -
Returns:
correct mimetype for the image data represented by this byte data


Copyright © 2005-2010 java.net. All Rights Reserved.