try
{
oOS.write("TAG".getBytes());
// song title
if (getTitle() != null)
{
byte[] abySongTitle = getTitle().getBytes();
oOS.write(abySongTitle);
oOS.write(new byte[30 - abySongTitle.length]); // padding to equal 30 bytes for song title
}
else
{
oOS.write(new byte[30]); // no value, just padding
}
// artist
if (getArtist() != null)
{
byte[] abyArtist = getArtist().getBytes();
oOS.write(abyArtist);
oOS.write(new byte[30 - abyArtist.length]); // padding to equal 30 bytes for artist
}
else
{
oOS.write(new byte[30]); // no value, just padding
}
// album
if (getAlbum() != null)
{
byte[] abyAlbum = getAlbum().getBytes();
oOS.write(abyAlbum);
oOS.write(new byte[30 - abyAlbum.length]); // padding to equal 30 bytes for album
}
else
{
oOS.write(new byte[30]);
}
// year
if (getYear() != null)
{
byte[] abyYear = getYear().getBytes();
oOS.write(abyYear);
oOS.write(new byte[4 - abyYear.length]); // padding to equal 4 bytes for year
}
else
{
oOS.write(new byte[4]); // no value, just padding
}
// comment
if (getComment() != null)
{
byte[] abyComment = getComment().getBytes();
oOS.write(abyComment);
oOS.write(new byte[30 - abyComment.length]); // padding to equal 30 bytes for comment
}
else
{
oOS.write(new byte[30]); // no value, just padding
}
// genre
if (getGenre() != null)
{
oOS.write(getGenre().getByteValue());
}
else
{
oOS.write(0);
}
}
catch (Exception e)
{
throw new ID3Exception(e);
}