net.neoremind.fountain.util
类 SocketHelper
java.lang.Object
net.neoremind.fountain.util.SocketHelper
public class SocketHelper
- extends Object
操作socket的帮住类,支持写入读取数据到socket,封装操作socket的内部细节和异常处理
- 作者:
- hexiufeng, zhangxu
|
方法摘要 |
static byte[] |
getBuffer(Socket socket,
int len)
从socket中读取指定长度的数据,该方法会堵塞调用线程直到指定长度的数据完全被获取 |
static void |
writeByte(Socket socket,
byte[] data)
写入指定的数据到socket |
| 从类 java.lang.Object 继承的方法 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SocketHelper
public SocketHelper()
getBuffer
public static byte[] getBuffer(Socket socket,
int len)
throws IOException
- 从socket中读取指定长度的数据,该方法会堵塞调用线程直到指定长度的数据完全被获取
- 参数:
socket - len -
- 返回:
-
- 抛出:
IOException
writeByte
public static void writeByte(Socket socket,
byte[] data)
throws IOException
- 写入指定的数据到socket
- 参数:
socket - data -
- 抛出:
IOException
Copyright © 2016 neoremind. All rights reserved.