List of usage examples for java.nio.charset StandardCharsets UTF_8
Charset UTF_8
To view the source code for java.nio.charset StandardCharsets UTF_8.
Click Source Link
From source file:org.italiangrid.storm.webdav.fs.attrs.DefaultExtendedFileAttributesHelper.java
protected String getAttributeValue(UserDefinedFileAttributeView view, String attributeName) throws IOException { if (view.list().contains(attributeName)) { ByteBuffer buffer = ByteBuffer.allocateDirect(view.size(attributeName)); view.read(attributeName, buffer); buffer.flip();/* w w w .j a va 2 s . c o m*/ return StandardCharsets.UTF_8.decode(buffer).toString(); } else { return ""; } }
From source file:io.spring.batch.xstream.SerializationTest.java
@Test public void testDeserialization() throws Exception { XStreamExecutionContextStringSerializer serializer = new XStreamExecutionContextStringSerializer(); serializer.afterPropertiesSet();//from ww w .ja va 2 s .c o m serializer .deserialize(new ByteArrayInputStream(EXAMPLE_EXECUTION_CONTEXT.getBytes(StandardCharsets.UTF_8))); }
From source file:azkaban.project.FlowLoaderUtils.java
/** * Sets props in flow yaml file.//from ww w . j a v a 2 s . c o m * * @param path the flow or job path delimited by ":", e.g. "flow:subflow1:subflow2:job3" * @param flowFile the flow yaml file * @param prop the props to set */ public static void setPropsInYamlFile(final String path, final File flowFile, final Props prop) { final DumperOptions options = new DumperOptions(); options.setDefaultFlowStyle(FlowStyle.BLOCK); final NodeBean nodeBean = FlowLoaderUtils.setPropsInNodeBean(path, flowFile, prop); try (final BufferedWriter writer = Files.newBufferedWriter(flowFile.toPath(), StandardCharsets.UTF_8)) { new Yaml(options).dump(nodeBean, writer); } catch (final IOException e) { throw new ProjectManagerException("Failed to set properties in flow file " + flowFile.getName()); } }
From source file:com.github.javaparser.javadoc.JavadocExtractorTest.java
private void processFile(File file) throws FileNotFoundException { try {/*from w w w . j a va2 s .c om*/ CompilationUnit cu = JavaParser.parse(file, StandardCharsets.UTF_8); new VoidVisitorAdapter<Object>() { @Override public void visit(JavadocComment n, Object arg) { super.visit(n, arg); n.parse(); } }.visit(cu, null); } catch (ParseProblemException e) { System.err.println("ERROR PROCESSING " + file); } }
From source file:car_counter.storage.sqlite.TestSqliteStorage.java
@Before public void setUp() throws Exception { dbFile = Files.createTempFile("test", ".db"); String iniValue = String.format("[Storage]\n" + "implementation = sqlite\n" + "database = %s\n", dbFile); try (InputStream stream = IOUtils.toInputStream(iniValue, StandardCharsets.UTF_8)) { ini = new Wini(stream); }//from w ww . ja v a 2s . c om }
From source file:com.hurence.logisland.processor.hbase.util.StringSerDe.java
@Override public void serialize(final OutputStream out, final String value) throws SerializationException, IOException { out.write(value.getBytes(StandardCharsets.UTF_8)); }
From source file:io.jmnarloch.cd.go.plugin.gradle.GradleTaskView.java
/** * {@inheritDoc}//from w w w. j a va 2s.c om */ @Override public String template() { try (InputStream inputStream = getClass().getResourceAsStream(TEMPLATE_PATH)) { return IOUtils.toString(inputStream, StandardCharsets.UTF_8); } catch (IOException e) { throw new PluginException("The view template could not be loaded.", e); } }
From source file:edu.kit.scc.test.rest.AuthorizationTest.java
@Test public void testBasicAuthorization() { String auth = restUser + ":" + restPassword; byte[] authZheader = auth.getBytes(); String authorizationHeader = "Basic " + new String(Base64.encodeBase64(authZheader), StandardCharsets.UTF_8); assertTrue(controller.verifyAuthorization(authorizationHeader)); }
From source file:io.codis.nedis.util.NedisUtils.java
public static byte[] toBytes(String value) { return value.getBytes(StandardCharsets.UTF_8); }