java.net.Socket.shutdownInput()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(253)

本文整理了Java中java.net.Socket.shutdownInput()方法的一些代码示例,展示了Socket.shutdownInput()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Socket.shutdownInput()方法的具体详情如下:
包路径:java.net.Socket
类名称:Socket
方法名:shutdownInput

Socket.shutdownInput介绍

[英]Closes the input stream of this socket. Any further data sent to this socket will be discarded. Reading from this socket after this method has been called will return the value EOF.
[中]关闭此套接字的输入流。任何发送到此套接字的进一步数据都将被丢弃。调用此方法后从该套接字读取将返回值EOF。

代码示例

代码示例来源:origin: aws/aws-sdk-java

@Override
public void shutdownInput() throws IOException {
  sock.shutdownInput();
}

代码示例来源:origin: alibaba/canal

public void close() {
  Socket socket = this.socket;
  if (socket != null) {
    try {
      socket.shutdownInput();
    } catch (IOException e) {
      // Ignore, could not do anymore
    }
    try {
      socket.shutdownOutput();
    } catch (IOException e) {
      // Ignore, could not do anymore
    }
    try {
      socket.close();
    } catch (IOException e) {
      // Ignore, could not do anymore
    }
  }
  this.input = null;
  this.output = null;
  this.socket = null;
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
protected void finalize() throws Throwable {
 try {
  if ( socket != null ) {
   socket.shutdownInput();
   socket.shutdownOutput();
   socket.close();
  }
 } catch ( java.io.IOException e ) {
  // Ignore errors
 } finally {
  super.finalize();
 }
}

代码示例来源:origin: apache/zookeeper

/**
 * See {@link Socket#shutdownInput()}. Calling this method does not trigger mode detection.
 */
@Override
public void shutdownInput() throws IOException {
  getSocketAllowUnknownMode().shutdownInput();
}

代码示例来源:origin: CarGuo/GSYVideoPlayer

private void closeSocketInput(Socket socket) {
  try {
    if (!socket.isInputShutdown()) {
      socket.shutdownInput();
    }
  } catch (SocketException e) {
    // There is no way to determine that client closed connection http://stackoverflow.com/a/10241044/999458
    // So just to prevent log flooding don't log stacktrace
  } catch (IOException e) {
    // onError(new ProxyCacheException("Error closing socket input stream", e));
  }
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
protected void finalize() throws Throwable {
 try {
  if ( socket != null ) {
   socket.shutdownInput();
   socket.shutdownOutput();
   socket.close();
  }
  if ( serverSocket != null ) {
   serverSocket.close();
  }
 } catch ( IOException e ) {
  // Ignore errors
 } finally {
  super.finalize();
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
protected void finalize() throws Throwable {
 try {
  if ( clientSocket != null ) {
   clientSocket.shutdownInput();
   clientSocket.shutdownOutput();
   clientSocket.close();
  }
  if ( serverSocket != null ) {
   serverSocket.close();
  }
 } catch ( java.io.IOException e ) {
  // Ignore errors
 } finally {
  super.finalize();
 }
}

代码示例来源:origin: aws/aws-sdk-java

@Override
public void shutdownInput() throws IOException {
  if (log.isDebugEnabled())
    log.debug("shutting down input of " + endpoint());
  sock.shutdownInput();
}

代码示例来源:origin: netty/netty

private void shutdownInput0(ChannelPromise promise) {
  try {
    socket.shutdownInput();
    promise.setSuccess();
  } catch (Throwable t) {
    promise.setFailure(t);
  }
}

代码示例来源:origin: jphp-group/jphp

@Signature
public Memory shutdownInput(Environment env, Memory... args) throws IOException {
  socket.shutdownInput();
  return Memory.NULL;
}

代码示例来源:origin: apache/activemq

public void close() throws IOException {
  if (rs.isOpen()) {
    rs.close();
    if (sc.isOpen()) {
      sc.socket().shutdownInput();
      sc.socket().close();
    }
    bb = null;
    sc = null;
  }
}

代码示例来源:origin: redisson/redisson

private void shutdownInput0(ChannelPromise promise) {
  try {
    socket.shutdownInput();
    promise.setSuccess();
  } catch (Throwable t) {
    promise.setFailure(t);
  }
}

代码示例来源:origin: jenkinsci/jenkins

s.shutdownInput();
} finally {
  s.close();

代码示例来源:origin: robovm/robovm

public void close() throws IOException {
  if (!this.open) {
    return;
  }
  this.open = false;
  doFlush();
  try {
    this.socket.shutdownOutput();
  } catch (IOException ignore) {
  }
  try {
    this.socket.shutdownInput();
  } catch (IOException ignore) {
  }
  this.socket.close();
}

代码示例来源:origin: netty/netty

private void shutdownInput0() throws Exception {
  if (PlatformDependent.javaVersion() >= 7) {
    javaChannel().shutdownInput();
  } else {
    javaChannel().socket().shutdownInput();
  }
}

代码示例来源:origin: wildfly/wildfly

private void shutdownInput0(ChannelPromise promise) {
  try {
    socket.shutdownInput();
    promise.setSuccess();
  } catch (Throwable t) {
    promise.setFailure(t);
  }
}

代码示例来源:origin: redisson/redisson

private void shutdownInput0() throws Exception {
  if (PlatformDependent.javaVersion() >= 7) {
    javaChannel().shutdownInput();
  } else {
    javaChannel().socket().shutdownInput();
  }
}

代码示例来源:origin: wildfly/wildfly

public void terminateReads() throws IOException {
  if (connection.readClosed()) try {
    if (getSelectionKey().isValid()) {
      suspend(SelectionKey.OP_READ);
    }
    if (socketChannel.isOpen()) try {
      socketChannel.socket().shutdownInput();
    } catch (SocketException ignored) {
      // IBM incorrectly throws this exception on ENOTCONN; it's probably less harmful just to swallow it
    }
  } catch (ClosedChannelException ignored) {
  } finally {
    readTerminated();
  }
}

代码示例来源:origin: wildfly/wildfly

private void shutdownInput0() throws Exception {
  if (PlatformDependent.javaVersion() >= 7) {
    javaChannel().shutdownInput();
  } else {
    javaChannel().socket().shutdownInput();
  }
}

代码示例来源:origin: square/okhttp

return false;
} else if (response.getSocketPolicy() == SHUTDOWN_INPUT_AT_END) {
 socket.shutdownInput();
} else if (response.getSocketPolicy() == SHUTDOWN_OUTPUT_AT_END) {
 socket.shutdownOutput();

相关文章

微信公众号

最新文章

更多