public class TcpSend extends Object implements AutoCloseable, Flushable
Modifier and Type | Method and Description |
---|---|
TcpSend |
bufferSize(int bufferSize) |
void |
close() |
void |
flush() |
String |
getHost() |
InputStream |
getInput() |
OutputStream |
getOutput() |
int |
getPort() |
Socket |
getSocket() |
int |
read(byte[] bs) |
int |
read(byte[] bs,
int off,
int len)
读取数据
|
TcpSend |
send(byte send) |
TcpSend |
send(byte[] send) |
TcpSend |
send(byte[] send,
int off,
int len)
发送数据
|
TcpSend |
sendLf()
发送 \n
|
TcpSend |
timeout(int timeOut) |
public TcpSend(String host, int port) throws IOException
IOException
public TcpSend bufferSize(int bufferSize) throws SocketException
SocketException
public TcpSend timeout(int timeOut) throws SocketException
SocketException
public TcpSend send(byte send) throws IOException
IOException
public TcpSend send(byte[] send) throws IOException
IOException
public TcpSend send(byte[] send, int off, int len) throws IOException
send
- bytesoff
- offsetlen
- lengthIOException
- IOExceptionpublic TcpSend sendLf() throws IOException
IOException
- IOExceptionpublic void flush() throws IOException
flush
in interface Flushable
IOException
public int read(byte[] bs) throws IOException
IOException
public int read(byte[] bs, int off, int len) throws IOException
bs
- bytesoff
- offsetlen
- lengthIOException
- IOExceptionpublic void close()
close
in interface AutoCloseable
public String getHost()
public int getPort()
public Socket getSocket()
public InputStream getInput()
public OutputStream getOutput()
Copyright © 2024. All rights reserved.