public boolean equals(Object obj) { if (this == obj) { return true; } return obj instanceof TextEncodedStringSizeTerminated && super.equals(obj); }
/** * If the filename or description cannot be encoded using current encoder, change the encoder */ public void write(ByteArrayOutputStream tagBuffer) { if (!((AbstractString) getObject(DataTypes.OBJ_FILENAME)).canBeEncoded()) { this.setTextEncoding(TextEncoding.UTF_16); } if (!((AbstractString) getObject(DataTypes.OBJ_DESCRIPTION)).canBeEncoded()) { this.setTextEncoding(TextEncoding.UTF_16); } super.write(tagBuffer); }
/** * Get the text encoding being used. * * The text encoding is defined by the frame body that the text field belongs to. * * @return the text encoding charset */ protected Charset getTextEncodingCharSet() { final byte textEncoding = this.getBody().getTextEncoding(); final Charset charSetName = TextEncoding.getInstanceOf().getCharsetForId(textEncoding); logger.finest("text encoding:" + textEncoding + " charset:" + charSetName.name()); return charSetName; } }
if(inBuffer.remaining()<=2) decoder = getTextEncodingCharSet().newDecoder(); decoder.reset(); return decoder; if(getTextEncodingCharSet()== StandardCharsets.UTF_16) decoder = getTextEncodingCharSet().newDecoder(); decoder.reset(); decoder = getTextEncodingCharSet().newDecoder(); decoder.reset();
/** * If the seller or description cannot be encoded using current encoder, change the encoder */ public void write(ByteArrayOutputStream tagBuffer) { if (!((AbstractString) getObject(DataTypes.OBJ_SELLER_NAME)).canBeEncoded()) { this.setTextEncoding(TextEncoding.UTF_16); } if (!((AbstractString) getObject(DataTypes.OBJ_DESCRIPTION)).canBeEncoded()) { this.setTextEncoding(TextEncoding.UTF_16); } super.write(tagBuffer); }
/** * Check the value can be encoded with the specified encoding * @return */ public boolean canBeEncoded() { //Try and write to buffer using the CharSet defined by the textEncoding field (note if using UTF16 we dont //need to worry about LE,BE at this point it makes no difference) byte textEncoding = this.getBody().getTextEncoding(); String charSetName = TextEncoding.getInstanceOf().getValueForId(textEncoding); CharsetEncoder encoder = Charset.forName(charSetName).newEncoder(); if (encoder.canEncode((String) value)) { return true; } else { logger.finest("Failed Trying to decode" + value + "with" + encoder.toString()); return false; } } }
/** * If the seller or description cannot be encoded using current encoder, change the encoder */ public void write(ByteArrayOutputStream tagBuffer) { if (!((AbstractString) getObject(DataTypes.OBJ_SELLER_NAME)).canBeEncoded()) { this.setTextEncoding(TextEncoding.UTF_16); } if (!((AbstractString) getObject(DataTypes.OBJ_DESCRIPTION)).canBeEncoded()) { this.setTextEncoding(TextEncoding.UTF_16); } super.write(tagBuffer); }
public boolean equals(Object obj) { if(this==obj) { return true; } return obj instanceof TextEncodedStringSizeTerminated && super.equals(obj); }
/** * Check the value can be encoded with the specified encoding * @return */ public boolean canBeEncoded() { //Try and write to buffer using the CharSet defined by the textEncoding field (note if using UTF16 we dont //need to worry about LE,BE at this point it makes no difference) final byte textEncoding = this.getBody().getTextEncoding(); final TextEncoding encoding = TextEncoding.getInstanceOf(); final Charset charset = encoding.getCharsetForId(textEncoding); CharsetEncoder encoder = charset.newEncoder(); if (encoder.canEncode((String) value)) { return true; } else { logger.finest("Failed Trying to decode" + value + "with" + encoder.toString()); return false; } }
/** * If the description cannot be encoded using current encoder, change the encoder */ public void write(ByteArrayOutputStream tagBuffer) { if (!((AbstractString) getObject(DataTypes.OBJ_DESCRIPTION)).canBeEncoded()) { this.setTextEncoding(TextEncoding.UTF_16); } super.write(tagBuffer); }
public boolean equals(Object obj) { if(this==obj) { return true; } return obj instanceof TextEncodedStringSizeTerminated && super.equals(obj); }
/** * Check the value can be encoded with the specified encoding * * @return */ public boolean canBeEncoded() { //Try and write to buffer using the CharSet defined by the textEncoding field (note if using UTF16 we dont //need to worry about LE,BE at this point it makes no difference) byte textEncoding = this.getBody().getTextEncoding(); String charSetName = TextEncoding.getInstanceOf().getValueForId(textEncoding); CharsetEncoder encoder = Charset.forName(charSetName).newEncoder(); if (encoder.canEncode((String) value)) { return true; } else { // logger.finest("Failed Trying to decode" + value + "with" + encoder.toString()); return false; } } }
/** * If the filename or description cannot be encoded using current encoder, change the encoder */ public void write(ByteArrayOutputStream tagBuffer) { if (!((AbstractString) getObject(DataTypes.OBJ_FILENAME)).canBeEncoded()) { this.setTextEncoding(TextEncoding.UTF_16); } if (!((AbstractString) getObject(DataTypes.OBJ_DESCRIPTION)).canBeEncoded()) { this.setTextEncoding(TextEncoding.UTF_16); } super.write(tagBuffer); }
/** * @param obj * @return if obj is equivalent to this */ public boolean equals(Object obj) { if (!(obj instanceof StringFixedLength)) { return false; } StringFixedLength object = (StringFixedLength) obj; return this.size == object.size && super.equals(obj); }
/** * If the text cannot be encoded using current encoder, change the encoder * * @param tagBuffer * @throws java.io.IOException */ public void write(ByteArrayOutputStream tagBuffer) { if (!((AbstractString) getObject(DataTypes.OBJ_TEXT)).canBeEncoded()) { this.setTextEncoding(TextEncoding.UTF_16); } super.write(tagBuffer); }
/** * @param obj * @return if obj is equivalent to this */ public boolean equals(Object obj) { if (!(obj instanceof StringFixedLength)) { return false; } StringFixedLength object = (StringFixedLength) obj; return this.size == object.size && super.equals(obj); }
/** * If the seller or description cannot be encoded using current encoder, change the encoder */ public void write(ByteArrayOutputStream tagBuffer) { if (!((AbstractString) getObject(DataTypes.OBJ_SELLER_NAME)).canBeEncoded()) { this.setTextEncoding(TextEncoding.UTF_16); } if (!((AbstractString) getObject(DataTypes.OBJ_DESCRIPTION)).canBeEncoded()) { this.setTextEncoding(TextEncoding.UTF_16); } super.write(tagBuffer); }
public boolean equals(Object obj) { return obj instanceof TextEncodedStringNullTerminated && super.equals(obj); }
/** * If the filename or description cannot be encoded using current encoder, change the encoder */ public void write(ByteArrayOutputStream tagBuffer) { if (!((AbstractString) getObject(DataTypes.OBJ_FILENAME)).canBeEncoded()) { this.setTextEncoding(TextEncoding.UTF_16); } if (!((AbstractString) getObject(DataTypes.OBJ_DESCRIPTION)).canBeEncoded()) { this.setTextEncoding(TextEncoding.UTF_16); } super.write(tagBuffer); }
public boolean equals(Object obj) { return obj instanceof TextEncodedStringNullTerminated && super.equals(obj); }