import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
response.setContentType(contentType);
final OutputStream out = response.getOutputStream();
try ( // Set the response type
- PrintWriter outWriter = new PrintWriter(
- new BufferedWriter(new OutputStreamWriter(out, "UTF-8")))) {
+ PrintWriter outWriter = new PrintWriter(new BufferedWriter(
+ new OutputStreamWriter(out, "UTF-8")))) {
outWriter.print(output);
outWriter.flush();
}
return null;
}
- String jsonString = readFile(scssCacheFile, Charset.forName("UTF-8"));
+ String jsonString = readFile(scssCacheFile, StandardCharsets.UTF_8);
JsonObject entryJson = Json.parse(jsonString);
String cacheEntryJsonString = cacheEntry.asJson();
try {
- writeFile(cacheEntryJsonString, cacheFile,
- Charset.forName("UTF-8"));
+ writeFile(cacheEntryJsonString, cacheFile, StandardCharsets.UTF_8);
} catch (IOException e) {
getLogger().log(Level.WARNING,
"Error persisting scss cache " + cacheFile, e);
import java.io.ByteArrayInputStream;
import java.io.File;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.Locale;
import org.jsoup.nodes.Attributes;
Boolean[] explicitImmediate = { null, Boolean.FALSE, Boolean.TRUE,
Boolean.TRUE };
boolean[] immediate = { true, false, true, true };
- for (int i = 0; i < design.length; i++) {
+ for (String design1 : design) {
component = (AbstractComponent) Design
.read(new ByteArrayInputStream(
- design[i].getBytes(Charset.forName("UTF-8"))));
+ design1.getBytes(StandardCharsets.UTF_8)));
}
}
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
for (int i = 0; i < buffer; i++) {
builder.append('a');
}
- byte[] bytes = builder.toString().getBytes(Charset.forName("UTF-8"));
+ byte[] bytes = builder.toString().getBytes(StandardCharsets.UTF_8);
ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
InputStreamImpl stream = new InputStreamImpl(inputStream, buffer / 2);
new CustomLayout(stream);
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
*/
public class DesignTest {
- private static Charset CP1251_CHARSET = Charset.forName("cp1251");
- private static Charset UTF8_CHARSET = Charset.forName("UTF-8");
+ private static final Charset CP1251_CHARSET = Charset.forName("cp1251");
+ private static final Charset UTF8_CHARSET = StandardCharsets.UTF_8;
private static String NON_ASCII_STRING = "\u043C";