Skip to content

Commit

Permalink
Avoid the charset lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Apr 26, 2017
1 parent 08e2c4a commit 228563e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions jansi/src/main/java/org/fusesource/jansi/AnsiOutputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Iterator;

Expand Down Expand Up @@ -117,7 +117,7 @@ public void write(int data) throws IOException {
case LOOKING_FOR_INT_ARG_END:
buffer[pos++] = (byte) data;
if (!('0' <= data && data <= '9')) {
String strValue = new String(buffer, startOfValue, (pos - 1) - startOfValue, "UTF-8");
String strValue = new String(buffer, startOfValue, (pos - 1) - startOfValue, Charset.defaultCharset());
Integer value = new Integer(strValue);
options.add(value);
if (data == ';') {
Expand All @@ -131,7 +131,7 @@ public void write(int data) throws IOException {
case LOOKING_FOR_STR_ARG_END:
buffer[pos++] = (byte) data;
if ('"' != data) {
String value = new String(buffer, startOfValue, (pos - 1) - startOfValue, "UTF-8");
String value = new String(buffer, startOfValue, (pos - 1) - startOfValue, Charset.defaultCharset());
options.add(value);
if (data == ';') {
state = LOOKING_FOR_NEXT_ARG;
Expand All @@ -154,7 +154,7 @@ public void write(int data) throws IOException {
case LOOKING_FOR_OSC_COMMAND_END:
buffer[pos++] = (byte) data;
if (';' == data) {
String strValue = new String(buffer, startOfValue, (pos - 1) - startOfValue, "UTF-8");
String strValue = new String(buffer, startOfValue, (pos - 1) - startOfValue, Charset.defaultCharset());
Integer value = new Integer(strValue);
options.add(value);
startOfValue = pos;
Expand All @@ -170,7 +170,7 @@ public void write(int data) throws IOException {
case LOOKING_FOR_OSC_PARAM:
buffer[pos++] = (byte) data;
if (BEL == data) {
String value = new String(buffer, startOfValue, (pos - 1) - startOfValue, "UTF-8");
String value = new String(buffer, startOfValue, (pos - 1) - startOfValue, Charset.defaultCharset());
options.add(value);
reset(processOperatingSystemCommand(options));
} else if (FIRST_ESC_CHAR == data) {
Expand All @@ -183,7 +183,7 @@ public void write(int data) throws IOException {
case LOOKING_FOR_ST:
buffer[pos++] = (byte) data;
if (SECOND_ST_CHAR == data) {
String value = new String(buffer, startOfValue, (pos - 2) - startOfValue, "UTF-8");
String value = new String(buffer, startOfValue, (pos - 2) - startOfValue, Charset.defaultCharset());
options.add(value);
reset(processOperatingSystemCommand(options));
} else {
Expand Down

0 comments on commit 228563e

Please sign in to comment.