< prev index next >

src/java.base/share/classes/sun/nio/cs/StreamEncoder.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 21,45 **** * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package sun.nio.cs; ! import java.io.FileOutputStream; ! import java.io.IOException; ! import java.io.OutputStream; ! import java.io.UnsupportedEncodingException; ! import java.io.Writer; ! import java.nio.ByteBuffer; ! import java.nio.CharBuffer; ! import java.nio.channels.WritableByteChannel; ! import java.nio.charset.Charset; ! import java.nio.charset.CharsetEncoder; ! import java.nio.charset.CoderResult; ! import java.nio.charset.CodingErrorAction; ! import java.nio.charset.IllegalCharsetNameException; public class StreamEncoder extends Writer { private static final int DEFAULT_BYTE_BUFFER_SIZE = 8192; --- 21,39 ---- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ + /* + */ + package sun.nio.cs; ! import java.io.*; ! import java.nio.*; ! import java.nio.channels.*; ! import java.nio.charset.*; public class StreamEncoder extends Writer { private static final int DEFAULT_BYTE_BUFFER_SIZE = 8192;
*** 162,176 **** public void close() throws IOException { synchronized (lock) { if (closed) return; ! try { ! implClose(); ! } finally { ! closed = true; ! } } } private boolean isOpen() { return !closed; --- 156,167 ---- public void close() throws IOException { synchronized (lock) { if (closed) return; ! implClose(); ! closed = true; } } private boolean isOpen() { return !closed;
*** 344,360 **** if (bb.position() > 0) writeBytes(); if (ch != null) ch.close(); ! else { ! try { ! out.flush(); ! } finally { ! out.close(); ! } ! } } catch (IOException x) { encoder.reset(); throw x; } } --- 335,346 ---- if (bb.position() > 0) writeBytes(); if (ch != null) ch.close(); ! else ! out.close(); } catch (IOException x) { encoder.reset(); throw x; } }
< prev index next >