MemoryStream
Overview
MemoryStream 是一个类在Java的FOSS中. 继承人: Stream, AutoCloseable.
读取和写入内存数据的记忆流.
这个类提供了23种方法,用于在Java程序中使用MemoryStream 对象. 有的方法包括: MemoryStream, Stream, close, copyTo, flush, getBuffer, getInputStream, getLength, getOutputStream, getSize, read, readByte,另外6种方法. 所有公众成员在安装了Java的FOSS包后,可以访问任何 Java应用程序. 特性: buffer, inputStream, length, outputStream, size.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
size | int | Read | 获取流中的数据大小. |
buffer | byte[] | Read | 得到缓冲. |
length | long | Read | 获取数据的长度. |
outputStream | OutputStream | Read | 得到输出流. |
inputStream | java.io.InputStream | Read | 得到输入流. |
Methods
| Signature | Description |
|---|---|
MemoryStream() | 创建一个新的存储器流,默认容量. |
MemoryStream(capacity: int) | 创建一个具有指定容量的新内存流. |
MemoryStream(data: byte[]) | 从现有数据创建一个新的内存流. |
getSize() → int | 获取流中的数据大小. |
getBuffer() → byte[] | 得到缓冲. |
setCapacity(cap: int) | 设置流量容量. |
getLength() → long | 获取数据的长度. |
setLength(len: long) | 设置流的长度. |
flush() | 清洗流 (没有存储器流的选项). |
readByte() → int | 读取流量的一个字节. |
read(buf: byte[]) → int | 读取流中的字节. |
read(buf: byte[], start: int, len: int) → int | 读取流中的字节. |
write(buf: byte[]) | 写字节到流. |
write(buf: byte[], start: int, len: int) | 写字节到流. |
writeByte(b: int) | 写入一个字节. |
seek(offset: long, seek: int) → long | 在河流中寻找位置. |
toArray() → byte[] | 将流转换为数组. |
close() | 关闭了流. |
copyTo(stream: Stream) | 将流内容复制到另一个流. |
copyTo(stream: OutputStream) | 将流内容复制到输出流. |
Stream(in: InputStream) | 文件流用于读取和写入文件. |
getOutputStream() → OutputStream | 返回输出流. |
getInputStream() → java.io.InputStream | 创建一个新的文件流. |