From 62391148856c5e886dd0c3165484538b86ddc8ed Mon Sep 17 00:00:00 2001 From: David Renshaw Date: Fri, 13 Jun 2014 17:24:39 -0400 Subject: [PATCH] make compatible with java 6 once again --- runtime/src/main/java/org/capnproto/Text.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/runtime/src/main/java/org/capnproto/Text.java b/runtime/src/main/java/org/capnproto/Text.java index 51edafa..0f43432 100644 --- a/runtime/src/main/java/org/capnproto/Text.java +++ b/runtime/src/main/java/org/capnproto/Text.java @@ -1,7 +1,6 @@ package org.capnproto; import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; public final class Text { @@ -18,7 +17,7 @@ public final class Text { public Reader(String value) { try { - byte[] bytes = value.getBytes(StandardCharsets.UTF_8.name()); + byte[] bytes = value.getBytes("UTF-8"); this.buffer = ByteBuffer.wrap(bytes); this.offset = 0; this.size = bytes.length; @@ -35,7 +34,7 @@ public final class Text { this.buffer.get(bytes, 0, this.size); try { - return new String(bytes, StandardCharsets.UTF_8.name()); + return new String(bytes, "UTF-8"); } catch (java.io.UnsupportedEncodingException e) { return "unsupported encoding"; // XXX } @@ -64,7 +63,7 @@ public final class Text { this.buffer.get(bytes, 0, this.size); try { - return new String(bytes, StandardCharsets.UTF_8.name()); + return new String(bytes, "UTF-8"); } catch (java.io.UnsupportedEncodingException e) { return "unsupported encoding"; // XXX }