Methods Summary |
---|
public void | accept(ID3Visitor oID3Visitor)
oID3Visitor.visitSYLTID3V2Frame(this);
|
public void | addSyncEntry(org.blinkenlights.jid3.v2.SYLTID3V2Frame$SyncEntry oSyncEntry)Add a sync entry to the frame.
if (oSyncEntry == null)
{
throw new ID3Exception("SyncEntry cannot be null.");
}
if (m_oSyncEntryMap.keySet().contains(new Integer(oSyncEntry.getTimestamp())))
{
throw new ID3Exception("SYLT frame already contains a sync entry for timestamp " + oSyncEntry.getTimestamp() + ".");
}
m_oSyncEntryMap.put(new Integer(oSyncEntry.getTimestamp()), oSyncEntry.getText());
|
public boolean | equals(java.lang.Object oOther)
if ((oOther == null) || (!(oOther instanceof SYLTID3V2Frame)))
{
return false;
}
SYLTID3V2Frame oOtherSYLT = (SYLTID3V2Frame)oOther;
return (m_oTextEncoding.equals(oOtherSYLT.m_oTextEncoding) &&
m_sLanguage.equals(oOtherSYLT.m_sLanguage) &&
m_oTimestampFormat.equals(oOtherSYLT.m_oTimestampFormat) &&
m_oContentType.equals(oOtherSYLT.m_oContentType) &&
m_sContentDescriptor.equals(oOtherSYLT.m_sContentDescriptor) &&
m_oSyncEntryMap.equals(oOtherSYLT.m_oSyncEntryMap));
|
public java.lang.String | getContentDescriptor()Get the content descriptor for this frame.
return m_sContentDescriptor;
|
public org.blinkenlights.jid3.v2.SYLTID3V2Frame$ContentType | getContentType()Get the content type.
return m_oContentType;
|
protected byte[] | getFrameId()
return "SYLT".getBytes();
|
public java.lang.String | getLanguage()Get the language used in this frame.
return m_sLanguage;
|
public org.blinkenlights.jid3.v2.SYLTID3V2Frame$SyncEntry | getSyncEntry(int iTimestamp)Get a sync entry from this frame.
if (m_oSyncEntryMap.keySet().contains(new Integer(iTimestamp)))
{
try
{
return new SyncEntry((String)m_oSyncEntryMap.get(new Integer(iTimestamp)), iTimestamp);
}
catch (Exception e) { return null; } // we've already created this object, so this can't happen
}
else
{
return null;
}
|
public TextEncoding | getTextEncoding()Get the text encoding used for the content descriptor and text in this frame.
return m_oTextEncoding;
|
public org.blinkenlights.jid3.v2.SYLTID3V2Frame$TimestampFormat | getTimestampFormat()Get the timestamp format used.
return m_oTimestampFormat;
|
public int[] | getTimestamps()Get all timestamps for which entries have been set in this frame.
int[] aiTimestamp = new int[m_oSyncEntryMap.keySet().size()];
int i=0;
Iterator oIter = m_oSyncEntryMap.keySet().iterator();
while (oIter.hasNext())
{
aiTimestamp[i] = ((Integer)oIter.next()).intValue();
i++;
}
return aiTimestamp;
|
public org.blinkenlights.jid3.v2.SYLTID3V2Frame$SyncEntry | removeSyncEntry(int iTimestamp)Remove a sync entry from this frame.
if (m_oSyncEntryMap.keySet().contains(new Integer(iTimestamp)))
{
try
{
return new SyncEntry((String)m_oSyncEntryMap.remove(new Integer(iTimestamp)), iTimestamp);
}
catch (Exception e) { return null; } // we've already created this object, so this can't happen
}
else
{
return null;
}
|
public void | setContentDescriptor(java.lang.String sContentDescriptor)Set the content descriptor for this frame.
String sOrigContentDescriptor = m_sContentDescriptor;
if (sContentDescriptor == null)
{
throw new ID3Exception("Content descriptor is required for SYLT frame.");
}
m_sContentDescriptor = sContentDescriptor;
// try this update, and reverse it if it generates and error
try
{
notifyID3Observers();
}
catch (ID3Exception e)
{
m_sContentDescriptor = sOrigContentDescriptor;
throw e;
}
|
public void | setContentType(org.blinkenlights.jid3.v2.SYLTID3V2Frame$ContentType oContentType)Set the content type.
m_oContentType = oContentType;
|
public void | setLanguage(java.lang.String sLanguage)Set the language used in this frame.
String sOrigLanguage = m_sLanguage;
if ((sLanguage == null) || (sLanguage.length() != 3))
{
throw new ID3Exception("A three character length language code is required in SYLT frame.");
}
m_sLanguage = sLanguage;
// try this update, and reverse it if it generates and error
try
{
notifyID3Observers();
}
catch (ID3Exception e)
{
m_sLanguage = sOrigLanguage;
throw e;
}
|
public void | setTextEncoding(TextEncoding oTextEncoding)Set the text encoding to be used for the content descriptor and text in this frame.
if (oTextEncoding == null)
{
throw new NullPointerException("Text encoding cannot be null.");
}
m_oTextEncoding = oTextEncoding;
|
public void | setTimestampFormat(org.blinkenlights.jid3.v2.SYLTID3V2Frame$TimestampFormat oTimestampFormat)Set the timestamp format used.
m_oTimestampFormat = oTimestampFormat;
|
public java.lang.String | toString()
StringBuffer sbText = new StringBuffer();
sbText.append("Synchronized lyrics/text: Language=[" + m_sLanguage + "], Timestamp format=[" + m_oTimestampFormat.getValue() +
"], Content type=[" + m_oContentType.getValue() + "], Content descriptor=[" + m_sContentDescriptor + "]");
Iterator oIter = m_oSyncEntryMap.keySet().iterator();
while (oIter.hasNext())
{
Integer oTimestamp = (Integer)oIter.next();
String sText = (String)m_oSyncEntryMap.get(oTimestamp);
sbText.append(" SyncEntry(" + oTimestamp.intValue() + ", " + sText + ")");
}
return sbText.toString();
|
protected void | writeBody(ID3DataOutputStream oIDOS)
// header
oIDOS.write(m_oTextEncoding.getEncodingValue()); // text encoding
oIDOS.write(m_sLanguage.getBytes()); // language
oIDOS.write(m_oTimestampFormat.getValue()); // timestamp format
oIDOS.write(m_oContentType.getValue()); // content type
oIDOS.write(m_sContentDescriptor.getBytes(m_oTextEncoding.getEncodingString())); // content descriptor
// null after content descriptor
if (m_oTextEncoding.equals(TextEncoding.ISO_8859_1))
{
oIDOS.writeUnsignedByte(0);
}
else
{
oIDOS.writeUnsignedByte(0);
oIDOS.writeUnsignedByte(0);
}
// sync entries
Iterator oIter = m_oSyncEntryMap.keySet().iterator();
while (oIter.hasNext())
{
Integer oTimestamp = (Integer)oIter.next();
String sText = (String)m_oSyncEntryMap.get(oTimestamp);
oIDOS.write(sText.getBytes(m_oTextEncoding.getEncodingString())); // sync text
// null after sync text
if (m_oTextEncoding.equals(TextEncoding.ISO_8859_1))
{
oIDOS.writeUnsignedByte(0);
}
else
{
oIDOS.writeUnsignedByte(0);
oIDOS.writeUnsignedByte(0);
}
oIDOS.writeBE32(oTimestamp.intValue()); // timestamp
}
|