Example usage for org.apache.commons.codec.binary StringUtils getBytesIso8859_1

List of usage examples for org.apache.commons.codec.binary StringUtils getBytesIso8859_1

Introduction

In this page you can find the example usage for org.apache.commons.codec.binary StringUtils getBytesIso8859_1.

Prototype

public static byte[] getBytesIso8859_1(final String string) 

Source Link

Document

Encodes the given string into a sequence of bytes using the ISO-8859-1 charset, storing the result into a new byte array.

Usage

From source file:de.pawlidi.openaletheia.utils.Converter.java

public static byte[] getBytesIso8859(final String string) {
    return StringUtils.getBytesIso8859_1(string);
}

From source file:yoyo.framework.standard.shared.commons.codec.StringUtilsTest.java

@Test
public void test() {
    String testee = org.apache.commons.lang3.StringUtils.EMPTY;
    assertThat(StringUtils.getBytesUnchecked(testee, "UTF-8"), is(ArrayUtils.EMPTY_BYTE_ARRAY));
    assertThat(StringUtils.getBytesIso8859_1(testee), is(ArrayUtils.EMPTY_BYTE_ARRAY));
    assertThat(StringUtils.getBytesUsAscii(testee), is(ArrayUtils.EMPTY_BYTE_ARRAY));
    assertThat(StringUtils.getBytesUtf8(testee), is(ArrayUtils.EMPTY_BYTE_ARRAY));
    assertThat(StringUtils.getBytesUtf16(testee), is(ArrayUtils.EMPTY_BYTE_ARRAY));
    assertThat(StringUtils.getBytesUtf16Le(testee), is(ArrayUtils.EMPTY_BYTE_ARRAY));
    assertThat(StringUtils.getBytesUtf16Be(testee), is(ArrayUtils.EMPTY_BYTE_ARRAY));
    assertThat(StringUtils.newString(ArrayUtils.EMPTY_BYTE_ARRAY, "UTF-8"), is(testee));
    assertThat(StringUtils.newStringIso8859_1(ArrayUtils.EMPTY_BYTE_ARRAY), is(testee));
    assertThat(StringUtils.newStringUsAscii(ArrayUtils.EMPTY_BYTE_ARRAY), is(testee));
    assertThat(StringUtils.newStringUtf8(ArrayUtils.EMPTY_BYTE_ARRAY), is(testee));
    assertThat(StringUtils.newStringUtf16(ArrayUtils.EMPTY_BYTE_ARRAY), is(testee));
    assertThat(StringUtils.newStringUtf16Le(ArrayUtils.EMPTY_BYTE_ARRAY), is(testee));
    assertThat(StringUtils.newStringUtf16Be(ArrayUtils.EMPTY_BYTE_ARRAY), is(testee));
}