Index: trunk/src/org/glassfish/json/JsonWriterImpl.java
===================================================================
--- trunk/src/org/glassfish/json/JsonWriterImpl.java	(revision 6756)
+++ trunk/src/org/glassfish/json/JsonWriterImpl.java	(revision 13231)
@@ -2,5 +2,5 @@
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
  *
  * The contents of this file are subject to the terms of either the GNU
@@ -9,10 +9,10 @@
  * may not use this file except in compliance with the License.  You can
  * obtain a copy of the License at
- * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
- * or packager/legal/LICENSE.txt.  See the License for the specific
+ * https://oss.oracle.com/licenses/CDDL+GPL-1.1
+ * or LICENSE.txt.  See the License for the specific
  * language governing permissions and limitations under the License.
  *
  * When distributing the software, include this License Header Notice in each
- * file and include the License file at packager/legal/LICENSE.txt.
+ * file and include the License file at LICENSE.txt.
  *
  * GPL Classpath Exception:
@@ -49,4 +49,5 @@
 import java.io.Writer;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.Map;
 
@@ -57,5 +58,4 @@
  */
 class JsonWriterImpl implements JsonWriter {
-    private static final Charset UTF_8 = Charset.forName("UTF-8");
 
     private final JsonGeneratorImpl generator;
@@ -75,9 +75,9 @@
 
     JsonWriterImpl(OutputStream out, BufferPool bufferPool) {
-        this(out, UTF_8, false, bufferPool);
+        this(out, StandardCharsets.UTF_8, false, bufferPool);
     }
 
     JsonWriterImpl(OutputStream out, boolean prettyPrinting, BufferPool bufferPool) {
-        this(out, UTF_8, prettyPrinting, bufferPool);
+        this(out, StandardCharsets.UTF_8, prettyPrinting, bufferPool);
     }
 
@@ -146,4 +146,26 @@
 
     @Override
+    public void write(JsonValue value) {
+        switch (value.getValueType()) {
+            case OBJECT:
+                writeObject((JsonObject) value);
+                return;
+            case ARRAY:
+                writeArray((JsonArray) value);
+                return;
+            default:
+                if (writeDone) {
+                    throw new IllegalStateException(JsonMessages.WRITER_WRITE_ALREADY_CALLED());
+                }
+                writeDone = true;
+                generator.write(value);
+                generator.flushBuffer();
+                if (os != null) {
+                    generator.flush();
+                }
+        }
+    }
+
+    @Override
     public void close() {
         writeDone = true;
