Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.esau.ptarmigan.impl.filter
Class ID3v1Filter  view ID3v1Filter download ID3v1Filter.java

java.lang.Object
  extended byorg.xml.sax.helpers.XMLFilterImpl
      extended byorg.esau.ptarmigan.impl.filter.BaseFilter
          extended byorg.esau.ptarmigan.impl.filter.BinaryFilter
              extended byorg.esau.ptarmigan.impl.filter.ID3v1Filter
All Implemented Interfaces:
org.esau.ptarmigan.impl.ByteStreamSource, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.esau.ptarmigan.impl.RandomAccessFileSource, org.xml.sax.XMLFilter, org.xml.sax.XMLReader

public final class ID3v1Filter
extends BinaryFilter
implements org.esau.ptarmigan.impl.RandomAccessFileSource

Extract metadata from an ID3v1 tag

It's a 128-byte block at the end of a file.

May appear on MP3, Ogg, Flac, and other files.

Note that it is unsupported with streams, at least for now. This is because of the overhead required in scanning to the end of the file.

Version:
$Revision: 1.4 $ $Date: 2002/09/19 03:42:01 $

Field Summary
(package private) static byte[] ID3_MARKER
           
(package private) static int ID3V1_TAG_LENGTH
           
(package private) static int ITEM_ALBUM_LENGTH
           
(package private) static int ITEM_ARTIST_LENGTH
           
(package private) static int ITEM_COMMENT_LENGTH
           
(package private) static int ITEM_TAG_LENGTH
           
(package private) static int ITEM_TITLE_LENGTH
           
(package private) static int ITEM_YEAR_LENGTH
           
(package private) static org.apache.commons.logging.Log log
          logging object
(package private)  java.io.File m_file
           
(package private) static java.lang.String NS_PREFIX
           
(package private) static java.lang.String NS_URI
           
 
Fields inherited from class org.esau.ptarmigan.impl.filter.BinaryFilter
ERROR_MSG, m_cis, m_limit_to_impose
 
Fields inherited from class org.esau.ptarmigan.impl.filter.BaseFilter
EMPTY_ATTRS, m_media_properties
 
Fields inherited from class org.xml.sax.helpers.XMLFilterImpl
 
Constructor Summary
ID3v1Filter()
           
 
Method Summary
 void doParse()
          SAX-Invoked parse of a 'document' from an input stream.
(package private)  java.io.InputStream getByteStream(java.lang.String system_id)
          obtain the id3 tag as a stream of bytes, for handy parsing Many different filetypes may have an ID3v1 tag (128 bytes) attached to their end.
(package private)  java.lang.String getNamespacePrefix()
           
(package private)  java.lang.String getNamespaceURI()
           
(package private)  void maybeWrite(byte[] buf, int length, java.lang.String xml_name)
           
(package private)  void writeID3v1()
          build the xml content
 
Methods inherited from class org.esau.ptarmigan.impl.filter.BinaryFilter
counter, doParse, fastForward, read, read, read, readCharBE, readCharLE, readInt16BE, readInt16LE, readInt24BE, readInt24LE, readInt32BE, readInt32LE, remaining, rewind, setCounterLimit, skip
 
Methods inherited from class org.esau.ptarmigan.impl.filter.BaseFilter
characters, getChars, getMediaProperties, parse, setMediaProperties, sourceIsXML, write, write, write, write, write, write, write, write, write, write, write, writeDate, writeDate, writeDate, writeDate, writeInteger, writeInteger, writeInteger, writeInteger, writeInteger, writeString, writeString, writeString, writeString, writeString
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endDocument, endElement, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID3V1_TAG_LENGTH

static final int ID3V1_TAG_LENGTH
See Also:
Constant Field Values

ITEM_TAG_LENGTH

static final int ITEM_TAG_LENGTH
See Also:
Constant Field Values

ITEM_TITLE_LENGTH

static final int ITEM_TITLE_LENGTH
See Also:
Constant Field Values

ITEM_ARTIST_LENGTH

static final int ITEM_ARTIST_LENGTH
See Also:
Constant Field Values

ITEM_ALBUM_LENGTH

static final int ITEM_ALBUM_LENGTH
See Also:
Constant Field Values

ITEM_YEAR_LENGTH

static final int ITEM_YEAR_LENGTH
See Also:
Constant Field Values

ITEM_COMMENT_LENGTH

static final int ITEM_COMMENT_LENGTH
See Also:
Constant Field Values

m_file

java.io.File m_file

ID3_MARKER

static final byte[] ID3_MARKER

NS_URI

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

NS_PREFIX

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

log

static org.apache.commons.logging.Log log
logging object

Constructor Detail

ID3v1Filter

public ID3v1Filter()
            throws org.xml.sax.SAXException
Method Detail

getNamespaceURI

java.lang.String getNamespaceURI()
Specified by:
getNamespaceURI in class BaseFilter

getNamespacePrefix

java.lang.String getNamespacePrefix()
Specified by:
getNamespacePrefix in class BaseFilter

doParse

public void doParse()
             throws org.xml.sax.SAXException,
                    java.io.IOException,
                    java.text.ParseException
SAX-Invoked parse of a 'document' from an input stream.

Note that the caller must already have called this.getByteStream() to obtain the raw data for the tag.

This module creates the document from the parsed ID3V1 metadata.

Specified by:
doParse in class BinaryFilter

writeID3v1

void writeID3v1()
          throws java.io.IOException,
                 org.xml.sax.SAXException,
                 java.text.ParseException
build the xml content


getByteStream

java.io.InputStream getByteStream(java.lang.String system_id)
                            throws java.io.IOException,
                                   org.xml.sax.SAXException
obtain the id3 tag as a stream of bytes, for handy parsing Many different filetypes may have an ID3v1 tag (128 bytes) attached to their end.

Overrides:
getByteStream in class BaseFilter

maybeWrite

void maybeWrite(byte[] buf,
                int length,
                java.lang.String xml_name)
          throws java.io.IOException,
                 org.xml.sax.SAXException