4918N/A * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Output stream for application data. This is the kind of stream 0N/A * that's handed out via SSLSocket.getOutputStream(). It's all the application 0N/A * Once the initial handshake has completed, application data may be 0N/A * interleaved with handshake data. That is handled internally and remains 0N/A * transparent to the application. 0N/A * @author David Brownell 0N/A // One element array used to implement the write(byte) method 0N/A * Write the data out, NOW. 0N/A // check if the Socket is invalid (error or closed) 4466N/A * By default, we counter chosen plaintext issues on CBC mode 4466N/A * data in the first record of every payload, and the rest in 4466N/A * subsequent record(s). Note that the issues have been solved in 4466N/A * It is not necessary to split the very first application record of 4466N/A * a freshly negotiated TLS session, as there is no previous 4466N/A * application data to guess. To improve compatibility, we will not 4466N/A * This avoids issues in the outbound direction. For a full fix, 4466N/A * the peer must have similar protections. 0N/A // Always flush at the end of each application level record. 0N/A // This lets application synchronize read and write streams 0N/A // however they like; if we buffered here, they couldn't. 4918N/A * Nagle's algorithm (TCP_NODELAY) was coming into 4918N/A * play here when writing short (split) packets. 4918N/A * Signal to the OutputRecord code to internally 4918N/A * buffer this small packet until the next outbound 4918N/A * packet (of any type) is written. 897N/A // NOTE: *must* call c.writeRecord() even for howmuch == 0 0N/A // shutdown and rethrow (wrapped) exception as appropriate 0N/A * Write one byte now. 0N/A * Socket close is already synchronized, no need to block here. 0N/A // inherit no-op flush()