src/java.base/share/classes/java/net/SocketOutputStream.java
changeset 49249 92cca24c8807
parent 48224 be0df5ab3093
child 50425 43b54a307c89
equal deleted inserted replaced
49248:15a0e60c8b97 49249:92cca24c8807
     1 /*
     1 /*
     2  * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    36  * public.
    36  * public.
    37  *
    37  *
    38  * @author      Jonathan Payne
    38  * @author      Jonathan Payne
    39  * @author      Arthur van Hoff
    39  * @author      Arthur van Hoff
    40  */
    40  */
    41 class SocketOutputStream extends FileOutputStream
    41 class SocketOutputStream extends FileOutputStream {
    42 {
       
    43     static {
    42     static {
    44         init();
    43         init();
    45     }
    44     }
    46 
    45 
    47     private AbstractPlainSocketImpl impl = null;
    46     private AbstractPlainSocketImpl impl = null;
   109         FileDescriptor fd = impl.acquireFD();
   108         FileDescriptor fd = impl.acquireFD();
   110         try {
   109         try {
   111             socketWrite0(fd, b, off, len);
   110             socketWrite0(fd, b, off, len);
   112         } catch (SocketException se) {
   111         } catch (SocketException se) {
   113             if (se instanceof sun.net.ConnectionResetException) {
   112             if (se instanceof sun.net.ConnectionResetException) {
   114                 impl.setConnectionResetPending();
   113                 impl.setConnectionReset();
   115                 se = new SocketException("Connection reset");
   114                 se = new SocketException("Connection reset");
   116             }
   115             }
   117             if (impl.isClosedOrPending()) {
   116             if (impl.isClosedOrPending()) {
   118                 throw new SocketException("Socket closed");
   117                 throw new SocketException("Socket closed");
   119             } else {
   118             } else {