xlang v5.1 Release
程序设计语言基础库文档
载入中...
搜索中...
未找到
StreamSocket.x
浏览该文件的文档.
1
6
7 // 位置常量定义
8 public static const int SeekBegin; // 从流开始位置定位
9 public static const int SeekCurrent; // 从当前位置定位
10 public static const int SeekEnd; // 从流末尾位置定位
11
12
13 // Socket标志常量
14 public static const int FLAGS_READABLE; // 可读标志
15 public static const int FLAGS_WRITEABLE; // 可写标志
16 public static const int FLAGS_EXCEPTION; // 异常标志
17
18
19 // 基本读写操作
20 public int read(byte[], int, int) // 从流中读取数据
22 public int write(byte[], int, int) // 向流中写入数据
24
25
26 // 流位置操作
27 public long seek(int, long) // 移动流位置
29 public long getPosition() // 获取当前位置
31 public long length() // 获取流长度
33
34
35 // 流可用性检查
36 public long available(bool) // 检查流可用数据量
38
39
40 // 流操作
41 public void flush() // 刷新流
42 throws IOException;
43 public void close() // 关闭流
45
46
47 // 基本数据类型写入(大端序)
48 public final void writeChar(char) // 写入字符
50 public final void writeShort(short) // 写入短整型
52 public final void writeInt(int) // 写入整型
54 public final void writeLong(long) // 写入长整型
56 public final void writeFloat(float) // 写入单精度浮点数
58 public final void writeDouble(double) // 写入双精度浮点数
60 public final void writeBool(bool) // 写入布尔值
62 public final void writeString(String) // 写入字符串
64
65
66 // 基本数据类型读取(大端序)
67 public final byte read()
69 public final char readChar() // 读取字符
71 public final short readShort() // 读取短整型
73 public final int readInt() // 读取整型
75 public final long readLong() // 读取长整型
77 public final float readFloat() // 读取单精度浮点数
79 public final double readDouble() // 读取双精度浮点数
81 public final bool readBool() // 读取布尔值
83 public final @NotNilptr String readString() // 读取字符串
85
86
87 // 单字节写入
88 public final void write(byte)
90
91
92 // 基本数据类型写入(小端序)
93 public final void writeCharLE(char) // 写入字符(小端序)
95 public final void writeShortLE(short) // 写入短整型(小端序)
97 public final void writeIntLE(int) // 写入整型(小端序)
99 public final void writeLongLE(long) // 写入长整型(小端序)
101 public final void writeFloatLE(float) // 写入单精度浮点数(小端序)
103 public final void writeDoubleLE(double) // 写入双精度浮点数(小端序)
105 public final void writeBoolLE(bool) // 写入布尔值(小端序)
107 public final void writeStringLE(String) // 写入字符串(小端序)
109
110
111 // 基本数据类型读取(小端序)
112 public final char readCharLE() // 读取字符(小端序)
114 public final short readShortLE() // 读取短整型(小端序)
116 public final int readIntLE() // 读取整型(小端序)
118 public final long readLongLE() // 读取长整型(小端序)
120 public final float readFloatLE() // 读取单精度浮点数(小端序)
122 public final double readDoubleLE() // 读取双精度浮点数(小端序)
124 public final bool readBoolLE() // 读取布尔值(小端序)
126 public final @NotNilptr String readStringLE() // 读取字符串(小端序)
128
129
130 // 批量读取
131 public final @NotNilptr byte[] readAllBytes() // 读取所有剩余字节
133
134
135 // 构造函数
137 throws IllegalArgumentException; // 构造函数
138
139
140 // 可用性检查(重载)
141 public int available(long, int); // 检查流可用数据量(重载方法)
142
143
144 // Socket操作
145 public long getHandle(); // 获取Socket句柄
146 public bool connect(InetAddress, int) // 连接到指定地址和端口
148 public bool connect(String, int, int) // 连接到指定主机、端口和超时
150 public bool listen(String, int, int);
151 public @NotNilptr InetAddress getRemoteInetAddress(); // 获取远程地址
152 public @NotNilptr InetAddress getLocalInetAddress();
153 public @NotNilptr String getRemoteIpAddress(); // 获取远程IP地址
154 public int getRemotePort(); // 获取远程端口
155 public @NotNilptr String getLocalIpAddress();
156 public int getLocalPort(); // 获取本地端口
157 public @NotNilptr StreamSocket accept()
159 public bool isConnected(); // 检查是否已连接
160
161
162 // Socket选项设置
163 public bool setSoTimeout(int); // 设置超时时间
164 public bool setTcpNoDelay(bool); // 设置TCP无延迟
165 public bool setKeepAlive(bool); // 设置保持连接
166 public bool getTcpNoDelay(); // 获取TCP无延迟状态
167 public bool getKeepAlive(); // 获取保持连接状态
168 public bool setReuseAddress(bool); // 设置地址重用
169 public bool getReuseAddress();
170
171
172 // 流关闭操作
173 public void shutdownInput(); // 关闭输入流
174 public void shutdownOutput(); // 关闭输出流
175 public bool setSoLinger(bool, int); // 设置SO_LINGER选项
176 public int getSoLinger(); // 获取SO_LINGER选项
177 public void finalize();
178 public static final int select(StreamSocket[], int, int, int, int[], int)
180};
Definition Stream.x:6
final byte [] readAllBytes()
final void writeBoolLE(bool)
final char readCharLE()
final int readInt()
static const int FLAGS_WRITEABLE
final bool readBoolLE()
bool setReuseAddress(bool)
String getRemoteIpAddress()
InetAddress getLocalInetAddress()
bool getTcpNoDelay()
long available(bool)
void finalize()
final void writeLong(long)
bool setKeepAlive(bool)
static const int FLAGS_EXCEPTION
String getLocalIpAddress()
long getPosition()
final short readShortLE()
static const int SeekBegin
Definition StreamSocket.x:8
StreamSocket accept()
bool listen(String, int, int)
final double readDoubleLE()
final float readFloatLE()
int write(byte[], int, int)
final bool readBool()
final void writeLongLE(long)
final String readStringLE()
final void writeShortLE(short)
static const int SeekCurrent
Definition StreamSocket.x:9
bool isConnected()
final void writeStringLE(String)
final void writeString(String)
bool connect(InetAddress, int)
final int readIntLE()
void flush()
final void writeCharLE(char)
int getLocalPort()
bool setSoLinger(bool, int)
final char readChar()
bool getKeepAlive()
bool getReuseAddress()
long getHandle()
final long readLong()
final void writeDoubleLE(double)
final float readFloat()
final double readDouble()
final void writeBool(bool)
void shutdownOutput()
void shutdownInput()
bool setTcpNoDelay(bool)
final String readString()
InetAddress getRemoteInetAddress()
static final int select(StreamSocket[], int, int, int, int[], int)
int read(byte[], int, int)
final long readLongLE()
void close()
final void writeDouble(double)
final void writeFloat(float)
static const int SeekEnd
bool setSoTimeout(int)
long length()
final void writeInt(int)
long seek(int, long)
int getSoLinger()
final void writeChar(char)
final void writeFloatLE(float)
final short readShort()
int getRemotePort()
final void writeIntLE(int)
static const int FLAGS_READABLE
final void writeShort(short)
final byte read()
Definition String.x:5