make compatible with java 6 once again
This commit is contained in:
parent
6364670998
commit
6239114885
1 changed files with 3 additions and 4 deletions
|
@ -1,7 +1,6 @@
|
||||||
package org.capnproto;
|
package org.capnproto;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
public final class Text {
|
public final class Text {
|
||||||
|
|
||||||
|
@ -18,7 +17,7 @@ public final class Text {
|
||||||
|
|
||||||
public Reader(String value) {
|
public Reader(String value) {
|
||||||
try {
|
try {
|
||||||
byte[] bytes = value.getBytes(StandardCharsets.UTF_8.name());
|
byte[] bytes = value.getBytes("UTF-8");
|
||||||
this.buffer = ByteBuffer.wrap(bytes);
|
this.buffer = ByteBuffer.wrap(bytes);
|
||||||
this.offset = 0;
|
this.offset = 0;
|
||||||
this.size = bytes.length;
|
this.size = bytes.length;
|
||||||
|
@ -35,7 +34,7 @@ public final class Text {
|
||||||
this.buffer.get(bytes, 0, this.size);
|
this.buffer.get(bytes, 0, this.size);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return new String(bytes, StandardCharsets.UTF_8.name());
|
return new String(bytes, "UTF-8");
|
||||||
} catch (java.io.UnsupportedEncodingException e) {
|
} catch (java.io.UnsupportedEncodingException e) {
|
||||||
return "unsupported encoding"; // XXX
|
return "unsupported encoding"; // XXX
|
||||||
}
|
}
|
||||||
|
@ -64,7 +63,7 @@ public final class Text {
|
||||||
this.buffer.get(bytes, 0, this.size);
|
this.buffer.get(bytes, 0, this.size);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return new String(bytes, StandardCharsets.UTF_8.name());
|
return new String(bytes, "UTF-8");
|
||||||
} catch (java.io.UnsupportedEncodingException e) {
|
} catch (java.io.UnsupportedEncodingException e) {
|
||||||
return "unsupported encoding"; // XXX
|
return "unsupported encoding"; // XXX
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue