Java Code Examples for java.nio.charset.Charset#toString()
The following examples show how to use
java.nio.charset.Charset#toString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompileJavaTask.java From javaide with GNU General Public License v3.0 | 5 votes |
private void loadCompilerOptions() { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); mCompileOptions = new CompileOptions(); String sourceCompatibility = pref.getString(context.getString(R.string.key_pref_source_compatibility), null); if (sourceCompatibility == null || sourceCompatibility.isEmpty()) { sourceCompatibility = JavaVersion.VERSION_1_7.toString(); } mCompileOptions.setSourceCompatibility(sourceCompatibility); String targetCompatibility = pref.getString(context.getString(R.string.key_pref_target_compatibility), null); if (targetCompatibility == null || targetCompatibility.isEmpty()) { targetCompatibility = JavaVersion.VERSION_1_7.toString(); } mCompileOptions.setTargetCompatibility(targetCompatibility); String encoding = pref.getString(context.getString(R.string.key_pref_source_encoding), null); if (encoding == null || encoding.isEmpty()) { encoding = Charset.forName("UTF-8").toString(); } else { try { Charset charset = Charset.forName(encoding); encoding = charset.toString(); } catch (Exception e) { encoding = Charset.forName("UTF-8").toString(); } } mCompileOptions.setEncoding(encoding); }
Example 2
Source File: RequestInterceptor.java From Aurora with Apache License 2.0 | 5 votes |
public static String convertCharset(Charset charset) { String s = charset.toString(); int i = s.indexOf("["); if (i == -1) return s; return s.substring(i + 1, s.length() - 1); }
Example 3
Source File: RequestInterceptor.java From MVVMArms with Apache License 2.0 | 5 votes |
public static String convertCharset(Charset charset) { String s = charset.toString(); int i = s.indexOf("["); if (i == -1) { return s; } return s.substring(i + 1, s.length() - 1); }
Example 4
Source File: RequestInterceptor.java From MVPArms with Apache License 2.0 | 5 votes |
public static String convertCharset(Charset charset) { String s = charset.toString(); int i = s.indexOf("["); if (i == -1) { return s; } return s.substring(i + 1, s.length() - 1); }
Example 5
Source File: PathUtil.java From zstack with Apache License 2.0 | 5 votes |
public static String readFileToString(String path, Charset charset) { try (UnicodeReader reader = new UnicodeReader(new FileInputStream(new File(path)), charset.toString())) { return IOUtils.toString(reader); } catch (IOException e) { throw new RuntimeException(e.getMessage()); } }
Example 6
Source File: RestClientResponseErrorHandler.java From sinavi-jfw with Apache License 2.0 | 5 votes |
private String getResponseBodyAsString(ClientHttpResponse response) { try { Charset charset = getCharset(response); return new String(getResponseBody(response), charset != null ? charset.toString() : DEFAULT_CHARSET); } catch (UnsupportedEncodingException ex) { throw new InternalException(RestClientResponseErrorHandler.class, "E-SPRINGMVC-REST-CLIENT-HANDLER#0001"); } }
Example 7
Source File: FromFileProperty.java From spring-cloud-contract with Apache License 2.0 | 4 votes |
public FromFileProperty(File file, Class type, Charset charset) { this.file = file; this.type = type; this.charset = charset.toString(); }