public EncodedText(byte textEncoding, byte[] value) { // if encoding type 1 and big endian BOM is present, switch to big endian if ((textEncoding == TEXT_ENCODING_UTF_16) && (textEncodingForBytesFromBOM(value) == TEXT_ENCODING_UTF_16BE)) { this.textEncoding = TEXT_ENCODING_UTF_16BE; } else { this.textEncoding = textEncoding; } this.value = value; this.stripBomAndTerminator(); }
public EncodedText(byte textEncoding, String string) { this.textEncoding = textEncoding; value = stringToBytes(string, characterSetForTextEncoding(textEncoding)); this.stripBomAndTerminator(); }
public EncodedText(String string) throws IllegalArgumentException { for (byte textEncoding : textEncodingFallback) { this.textEncoding = textEncoding; value = stringToBytes(string, characterSetForTextEncoding(textEncoding)); if (value != null && this.toString() != null) { this.stripBomAndTerminator(); return; } } throw new IllegalArgumentException("Invalid string, could not find appropriate encoding"); }
public EncodedText(byte textEncoding, byte[] value) { // if encoding type 1 and big endian BOM is present, switch to big endian if ((textEncoding == TEXT_ENCODING_UTF_16) && (textEncodingForBytesFromBOM(value) == TEXT_ENCODING_UTF_16BE)) { this.textEncoding = TEXT_ENCODING_UTF_16BE; } else { this.textEncoding = textEncoding; } this.value = value; this.stripBomAndTerminator(); }
public EncodedText(byte textEncoding, String string) { this.textEncoding = textEncoding; value = stringToBytes(string, characterSetForTextEncoding(textEncoding)); this.stripBomAndTerminator(); }
public EncodedText(String string) throws IllegalArgumentException { for (byte textEncoding : textEncodingFallback) { this.textEncoding = textEncoding; value = stringToBytes(string, characterSetForTextEncoding(textEncoding)); if (value != null && this.toString() != null) { this.stripBomAndTerminator(); return; } } throw new IllegalArgumentException("Invalid string, could not find appropriate encoding"); }