3227N/A/*
3227N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3227N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3227N/A *
3227N/A * This code is free software; you can redistribute it and/or modify it
3227N/A * under the terms of the GNU General Public License version 2 only, as
3227N/A * published by the Free Software Foundation.
3227N/A *
3227N/A * This code is distributed in the hope that it will be useful, but WITHOUT
3227N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3227N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3227N/A * version 2 for more details (a copy is included in the LICENSE file that
3227N/A * accompanied this code).
3227N/A *
3227N/A * You should have received a copy of the GNU General Public License version
3227N/A * 2 along with this work; if not, write to the Free Software Foundation,
3227N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3227N/A *
3227N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3227N/A * or visit www.oracle.com if you need additional information or have any
3227N/A * questions.
3227N/A */
3227N/A
3227N/A/*
3227N/A * @test
3227N/A * @bug 6415373
3227N/A * @summary Encoding nothing should output nothing
3227N/A */
3227N/A
3227N/Aimport java.io.*;
3227N/Aimport java.nio.charset.*;
3227N/A
3227N/Apublic class EncodingNothing {
3227N/A
3227N/A public static void main(String[] args) throws Throwable {
3227N/A int failed = 0;
3227N/A for (Charset cs : Charset.availableCharsets().values()) {
3227N/A if (! cs.canEncode())
3227N/A continue;
3227N/A System.out.printf("%s: ", cs.name());
3227N/A ByteArrayOutputStream baos = new ByteArrayOutputStream();
3227N/A OutputStreamWriter osw = new OutputStreamWriter(baos, cs);
3227N/A osw.close();
3227N/A if (baos.size() != 0) {
3227N/A System.out.printf(" Failed: output bytes=%d", baos.size());
3227N/A failed++;
3227N/A }
3227N/A System.out.println();
3227N/A }
3227N/A if (failed != 0)
3227N/A throw new AssertionError("Some tests failed");
3227N/A }
3227N/A}