Example usage for org.apache.commons.io Charsets UTF_8

List of usage examples for org.apache.commons.io Charsets UTF_8

Introduction

In this page you can find the example usage for org.apache.commons.io Charsets UTF_8.

Prototype

Charset UTF_8

To view the source code for org.apache.commons.io Charsets UTF_8.

Click Source Link

Document

Eight-bit Unicode Transformation Format.

Usage

From source file:com.fizzed.blaze.system.LineAction.java

public LineAction(Context context) {
    super(context);
    this.count = 10;
    this.charset = Charsets.UTF_8;
}

From source file:com.buaa.cfs.nfs3.request.LOOKUP3Request.java

@Override
@VisibleForTesting
public void serialize(XDR xdr) {
    handle.serialize(xdr);
    xdr.writeInt(name.getBytes(Charsets.UTF_8).length);
    xdr.writeFixedOpaque(name.getBytes(Charsets.UTF_8));
}

From source file:com.smartling.cms.gateway.client.upload.FileUploadTest.java

@Test
public void entityContainsCorrectContentType() throws Exception {
    response.setContentStream(new ByteArrayInputStream("ignored".getBytes(Charsets.UTF_8)));

    response.setContentType("some-content-type", "UTF-8");
    HttpEntity entity = response.getHttpEntity();

    assertEquals("some-content-type; charset=UTF-8", entity.getContentType().getValue());
}

From source file:com.callidusrobotics.droptables.exception.HtmlBodyErrorWriter.java

@Override
public long getSize(ErrorMessage message, Class<?> type, Type genericType, Annotation[] annotations,
        MediaType mediaType) {/*from  w  ww . j av  a  2 s  .  c  om*/
    return getData(message).getBytes(Charsets.UTF_8).length;
}

From source file:com.buaa.cfs.nfs3.request.MKDIR3Request.java

@Override
public void serialize(XDR xdr) {
    handle.serialize(xdr);//from www .  ja va2s  .c o  m
    xdr.writeInt(name.getBytes(Charsets.UTF_8).length);
    xdr.writeFixedOpaque(name.getBytes(Charsets.UTF_8));
    objAttr.serialize(xdr);
}

From source file:fi.ilmoeuro.membertrack.TestBase.java

private void initSchema() {
    try (final InputStream schemaFileStream = ResourceRoot.class.getResourceAsStream(SCHEMA_LIST_FILE)) {
        if (schemaFileStream == null) {
            throw new RuntimeException("Schema list not found");
        } else {/*from ww  w . j  av a  2 s  .  c o  m*/
            for (final String schemaFile : IOUtils.readLines(schemaFileStream, Charsets.UTF_8)) {
                try (final InputStream sqlStream = ResourceRoot.class.getResourceAsStream(schemaFile)) {
                    if (sqlStream == null) {
                        throw new RuntimeException(String.format("Schema file '%s' not found", schemaFile));
                    } else {
                        final String sql = IOUtils.toString(sqlStream, Charsets.US_ASCII);
                        for (String part : sql.split(";")) {
                            if (jooq == null) {
                                throw new IllegalStateException("jooq must be initialized");
                            } else {
                                jooq.execute(part);
                            }
                        }
                    }
                }
            }
        }
    } catch (IOException ex) {
        throw new RuntimeException("Couldn't retrieve schema file", ex);
    }
}

From source file:com.google.jenkins.plugins.googlecontainerregistryauth.GoogleContainerRegistryTokenSource.java

/** {@inheritDoc} */
@NonNull/*from   ww w.j av a2 s.  c o  m*/
@Override
public DockerRegistryToken convert(GoogleContainerRegistryCredential credential)
        throws AuthenticationTokenException {
    return new DockerRegistryToken(credential.getEmail(),
            Base64.encodeBase64String((credential.getUsername() + ":" + credential.getPassword().getPlainText())
                    .getBytes(Charsets.UTF_8)));
}

From source file:fi.ilmoeuro.membertrack.db.Migration.java

private static void runSqlFile(DSLContext jooq, String fileName)
        throws RuntimeException, IOException, DataAccessException {
    InputStream sqlStream = ResourceRoot.class.getResourceAsStream(fileName);
    if (sqlStream == null) {
        throw new RuntimeException(String.format("SQL file '%s'  not found", fileName));
    }// ww  w . j a  v a 2  s  .  c om
    String sql = IOUtils.toString(sqlStream, Charsets.UTF_8);
    log.info("Executing: {}", sql);
    for (String part : sql.split(";")) {
        jooq.execute(part);
    }
}

From source file:com.buaa.cfs.nfs3.request.LINK3Request.java

@Override
public void serialize(XDR xdr) {
    handle.serialize(xdr);//from   w w w .  ja v a 2 s .  c  o m
    fromDirHandle.serialize(xdr);
    xdr.writeInt(fromName.length());
    xdr.writeFixedOpaque(fromName.getBytes(Charsets.UTF_8), fromName.length());
}

From source file:com.splicemachine.tutorials.tsdbanalytics.dataobjects.ImpressionLogSerializer.java

@Override
public ImpressionLog deserialize(String s, byte[] bytes) {
    String jsonString = new String(bytes, Charsets.UTF_8);
    final ImpressionLog impressionLog = gson.fromJson(jsonString, ImpressionLog.class);
    return impressionLog;
}