Exemplo n.º 1
0
  protected void writeBody(ID3DataOutputStream oIDOS) throws IOException {
    // text encoding
    oIDOS.writeUnsignedByte(m_oTextEncoding.getEncodingValue());
    // price string
    oIDOS.write(m_sPrice.getBytes());
    oIDOS.writeUnsignedByte(0);
    // valid until
    oIDOS.write(m_sValidUntil.getBytes());
    // contact url
    oIDOS.write(m_sContactUrl.getBytes());
    oIDOS.writeUnsignedByte(0);
    // received as
    oIDOS.writeUnsignedByte(m_byReceivedAs);
    // name of seller
    if (m_sNameOfSeller != null) {
      oIDOS.write(m_sNameOfSeller.getBytes(m_oTextEncoding.getEncodingString()));
    }
    // null terminating optional name of seller
    if (m_oTextEncoding.equals(TextEncoding.ISO_8859_1)) {
      oIDOS.writeUnsignedByte(0);
    } else {
      oIDOS.writeUnsignedByte(0);
      oIDOS.writeUnsignedByte(0);
    }
    // description
    if (m_sDescription != null) {
      oIDOS.write(m_sDescription.getBytes(m_oTextEncoding.getEncodingString()));
    }
    // null terminating optional description
    if (m_oTextEncoding.equals(TextEncoding.ISO_8859_1)) {
      oIDOS.writeUnsignedByte(0);
    } else {
      oIDOS.writeUnsignedByte(0);
      oIDOS.writeUnsignedByte(0);
    }
    // optional company logo image
    if (m_abySellerLogoData != null) {
      // image mime type (optional, "image/" assumed if not set)
      if (m_sPictureMimeType != null) {
        oIDOS.write(m_sPictureMimeType.getBytes());
      }
      oIDOS.writeUnsignedByte(0); // terminating null

      // actual image data
      oIDOS.write(m_abySellerLogoData);
    }
  }
Exemplo n.º 2
0
  public boolean equals(Object oOther) {
    if ((oOther == null) || (!(oOther instanceof COMRID3V2Frame))) {
      return false;
    }

    COMRID3V2Frame oOtherCOMR = (COMRID3V2Frame) oOther;

    return (m_oTextEncoding.equals(oOtherCOMR.m_oTextEncoding)
        && m_sPrice.equals(oOtherCOMR.m_sPrice)
        && m_sValidUntil.equals(oOtherCOMR.m_sValidUntil)
        && m_sContactUrl.equals(oOtherCOMR.m_sContactUrl)
        && (m_byReceivedAs == oOtherCOMR.m_byReceivedAs)
        && m_sNameOfSeller.equals(oOtherCOMR.m_sNameOfSeller)
        && m_sDescription.equals(oOtherCOMR.m_sDescription)
        && m_sPictureMimeType.equals(oOtherCOMR.m_sPictureMimeType)
        && Arrays.equals(m_abySellerLogoData, oOtherCOMR.m_abySellerLogoData));
  }