コード例 #1
0
  /**
   * Because Text frames have a text encoding we need to check the text String does not contain
   * characters that cannot be encoded in current encoding before we write data. If there are change
   * the text encoding.
   */
  public void write(ByteArrayOutputStream tagBuffer) {
    // Ensure valid for type
    setTextEncoding(ID3TextEncodingConversion.getTextEncoding(getHeader(), getTextEncoding()));

    // Ensure valid for data
    if (!((TextEncodedStringSizeTerminated) getObject(DataTypes.OBJ_TEXT)).canBeEncoded()) {
      this.setTextEncoding(ID3TextEncodingConversion.getUnicodeTextEncoding(getHeader()));
    }
    super.write(tagBuffer);
  }
コード例 #2
0
 /**
  * Because have a text encoding we need to check the data values do not contain characters that
  * cannot be encoded in current encoding before we write data. If they do change the encoding.
  */
 public void write(ByteArrayOutputStream tagBuffer) {
   if (!((PairedTextEncodedStringNullTerminated) getObject(DataTypes.OBJ_TEXT)).canBeEncoded()) {
     this.setTextEncoding(TextEncoding.UTF_16);
   }
   super.write(tagBuffer);
 }
コード例 #3
0
 /** If the description cannot be encoded using current encoder, change the encoder */
 public void write(ByteArrayOutputStream tagBuffer) {
   if (((AbstractString) getObject(DataTypes.OBJ_DESCRIPTION)).canBeEncoded() == false) {
     this.setTextEncoding(TextEncoding.UTF_16);
   }
   super.write(tagBuffer);
 }