Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## helliker.id3
Class ID3v1Tag

    java.lang.Object
      |
      +--helliker.id3.ID3v1Tag

All Implemented Interfaces:
  ID3Tag

public class ID3v1Tag
extends java.lang.Object
implements ID3Tag

Constructor Summary
`ID3v1Tag(java.io.File mp3)` Create an id3v1tag from the file specified.

Method Summary
`void` | `copyFrom(ID3Tag tag)` Copies information from the ID3Tag parameter and inserts it into this tag.
`java.lang.String` | `getAlbum()` Return the album field of the tag
`java.lang.String` | `getArtist()` Return the artist field of the tag
`byte[]` | `getBytes()` Returns a binary representation of this id3v1 tag.
`java.lang.String` | `getComment()` Return the comment field of the tag
`int` | `getGenre()` Return the genre field of the tag
`java.lang.String` | `getGenreString()` Return the genre name based on the ID3/Nullsoft standards.
`int` | `getSize()` Return the size in bytes of the tag.
`java.lang.String` | `getTitle()` Return the title field of the tag
`int` | `getTrack()` Return the track field of the tag
`java.lang.String` | `getYear()` Return the year field of the tag
`void` | `removeTag()` Removes the id3v1 tag from the file specified in the constructor
`void` | `setAlbum(java.lang.String newAlbum)` Set the album field of the tag.
`void` | `setArtist(java.lang.String newArtist)` Set the artist field of the tag.
`void` | `setComment(java.lang.String newComment)` Set the comment field of the tag.
`void` | `setGenre(int newGenre)` Set the genre field of the tag.
`boolean` | `setGenreString(java.lang.String str)` Attempt to set the genre value of this tag from the string specified.
`void` | `setTitle(java.lang.String newTitle)` Set the title field of the tag.
`void` | `setTrack(int newTrack)` Set the track field of the tag.
`void` | `setYear(java.lang.String newYear)` Set the year field of the tag.
`boolean` | `tagExists()` Checks if a tag exists
`java.lang.String` | `toString()` Returns a String representation of this object.
`void` | `writeTag()` Writes the information in this tag to the file specified in the constructor.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ID3v1Tag

    public ID3v1Tag(java.io.File mp3)
             throws java.io.FileNotFoundException,
                    java.io.IOException

  Create an id3v1tag from the file specified. If the file contains a tag, the information is automatically extracted.

Parameters:
  `mp3` - the file to read/write the tag to
Throws:
  `java.io.FileNotFoundException` - if an error occurs
  `java.io.IOException` - if an error occurs

Method Detail

### writeTag

    public void writeTag()
                  throws java.io.FileNotFoundException,
                         java.io.IOException

  Writes the information in this tag to the file specified in the constructor. If a tag does not exist, one will be created. If a tag already exists, it will be overwritten.

  Specified by:
    `writeTag` in interface `ID3Tag`
  Throws:
    `java.io.FileNotFoundException` - if an error occurs
    `java.io.IOException` - if an error occurs

### getBytes

    public byte[] getBytes()

  Returns a binary representation of this id3v1 tag. It is in the correct format according to the id3v1.1 specifications.

  Specified by:
    `getBytes` in interface `ID3Tag`
  Returns:
    a binary representation of this id3v1 tag

### removeTag

    public void removeTag()
                   throws java.io.FileNotFoundException,
                          java.io.IOException

  Removes the id3v1 tag from the file specified in the constructor

  Specified by:
    `removeTag` in interface `ID3Tag`
  Returns:
    true if the tag was removed successfully
  Throws:
    `java.io.FileNotFoundException` - if an error occurs
    `java.io.IOException` - if an error occurs

### getGenreString

    public java.lang.String getGenreString()

  Return the genre name based on the ID3/Nullsoft standards. If the genre value is not valid, null is returned.

  Returns:
    return the genre name or null if the genre value is not valid

### setGenreString

    public boolean setGenreString(java.lang.String str)

  Attempt to set the genre value of this tag from the string specified. The value returned is based on the ID3/Nullsoft standards. Returns true if a match is found in the table and false otherwise.

  Parameters:
    `str` - the string value of the genre to attempt to set
  Returns:
    true if a match is found, false otherwise

### tagExists

    public boolean tagExists()

  Checks if a tag exists

  Returns:
    true if a tag exists

### getTitle

    public java.lang.String getTitle()

  Return the title field of the tag

  Returns:
    the title field of the tag

### setTitle

    public void setTitle(java.lang.String newTitle)

  Set the title field of the tag. The maximum size of the String is 30. If the size exceeds the maximum size, the String will be truncated.

  Parameters:
    `newTitle` - the title for the tag

### getArtist

    public java.lang.String getArtist()

  Return the artist field of the tag

  Returns:
    the artist field of the tag

### setArtist

    public void setArtist(java.lang.String newArtist)

  Set the artist field of the tag. The maximum size of the String is 30. If the size exceeds the maximum size, the String will be truncated.

  Parameters:
    `newArtist` - the artist for the tag

### getAlbum

    public java.lang.String getAlbum()

  Return the album field of the tag

  Returns:
    the album field of the tag

### setAlbum

    public void setAlbum(java.lang.String newAlbum)

  Set the album field of the tag. The maximum size of the String is 30. If the size exceeds the maximum size, the String will be truncated.

  Parameters:
    `newAlbum` - the album for the tag

### getYear

    public java.lang.String getYear()

  Return the year field of the tag

  Returns:
    the year field of the tag

### setYear

    public void setYear(java.lang.String newYear)

  Set the year field of the tag. The maximum size of the String is 4. If the size exceeds the maximum size, the String will be truncated.

  Parameters:
    `newYear` - the year for the tag

### getComment

    public java.lang.String getComment()

  Return the comment field of the tag

  Returns:
    the comment field of the tag

### setComment

    public void setComment(java.lang.String newComment)

  Set the comment field of the tag. The maximum size of the String is 30. If the size exceeds the maximum size, the String will be truncated.

  Parameters:
    `newComment` - the comment of the tag

### getTrack

    public int getTrack()

  Return the track field of the tag

  Returns:
    the track field of the tag

### setTrack

    public void setTrack(int newTrack)

  Set the track field of the tag. The track number has to be between 0 and 255. If it is not, nothing will happen.

  Parameters:
    `newTrack` - the track of the tag

### getGenre

    public int getGenre()

  Return the genre field of the tag

  Returns:
    the genre field of the tag

### setGenre

    public void setGenre(int newGenre)
                  throws ID3FieldDataException

  Set the genre field of the tag. This probably should not be greater than 115, but supports values from 0-255.

  Parameters:
    `newGenre` - the genre of the tag
  Throws:
    `ID3FieldDataException` - if the value supplie is invalid

### getSize

    public int getSize()

  Return the size in bytes of the tag. This returns 128 if the tag exists and 0 otherwise.

  Returns:
    the size of the tag in bytes

### toString

    public java.lang.String toString()

  Returns a String representation of this object. Contains all information within the tag.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a String representation of this object

### copyFrom

    public void copyFrom(ID3Tag tag)

  Copies information from the ID3Tag parameter and inserts it into this tag. Previous data will be overwritten. [NOT IMPLEMENTED]

  Specified by:
    `copyFrom` in interface `ID3Tag`
  Parameters:
    `tag` - the tag to copy from

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD