< prev index next >

src/java.base/share/classes/java/net/SocketInputStream.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1995, 2018, 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) 1995, 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
*** 46,67 **** } private boolean eof; private AbstractPlainSocketImpl impl = null; private byte temp[]; - private Socket socket = null; /** * Creates a new SocketInputStream. Can only be called * by a Socket. This method needs to hang on to the owner Socket so * that the fd will not be closed. * @param impl the implemented socket input stream */ SocketInputStream(AbstractPlainSocketImpl impl) throws IOException { super(impl.getFileDescriptor()); this.impl = impl; - socket = impl.getSocket(); } /** * Returns the unique {@link java.nio.channels.FileChannel FileChannel} * object associated with this file input stream.</p> --- 46,65 ----
*** 234,260 **** public int available() throws IOException { int available = impl.available(); return eof ? 0 : available; } - /** - * Closes the stream. - */ - private boolean closing = false; - public void close() throws IOException { - // Prevent recursion. See BugId 4484411 - if (closing) - return; - closing = true; - if (socket != null) { - if (!socket.isClosed()) - socket.close(); - } else - impl.close(); - closing = false; - } - void setEOF(boolean eof) { this.eof = eof; } /** --- 232,241 ----
< prev index next >