StreamContainer 类

Summary: Represents stream container which contains the stream and provides stream processing routines.

Module: aspose.imaging

Full Name: aspose.imaging.StreamContainer

Inheritance: DisposableObject

Constructors

Name描述
StreamContainer(stream)初始化一个新的 StreamContainer 类实例。
StreamContainer(stream, dispose_stream)初始化一个新的 StreamContainer 类实例。

Properties

NameTypeAccess描述
READ_WRITE_BYTES_COUNT [static]intr指定顺序读取时的读写字节计数。
can_readboolr获取一个值,指示流是否支持读取。
can_seekboolr获取一个值,指示流是否支持定位。
can_writeboolr获取一个值,指示流是否支持写入。
disposedboolr获取一个值,指示此实例是否已释放。
is_stream_disposed_on_closeboolr获取一个值,指示此流在关闭时是否被释放。
lengthintr/w获取或设置流的字节长度。此值小于在 StreamContainer 构造函数中传入的起始流位置所产生的值。
positionintr/w获取或设置流中的当前位置。此值表示相对于在 StreamContainer 构造函数中传入的起始流位置的偏移量。
_io.BufferedRandomr获取数据流。
sync_rootSystem.Objectr获取一个可用于同步对同步资源访问的对象。

Methods

Name描述
flush()清除此流的所有缓冲区,并导致任何缓冲的数据写入底层设备。
read(buffer, offset, count)从当前流读取一系列字节,并将流中的位置前移读取的字节数。
read(bytes)读取字节以填充指定的字节缓冲区。
read_byte()从流中读取一个字节,并将流中的位置前移一个字节;如果已到达流的末尾,则返回 -1。
save(destination_stream)将流的数据保存(复制)到指定的流。使用默认缓冲区大小 StreamContainer.READ_WRITE_BYTES_COUNT 和流的 StreamContainer.length 值。
save(destination_stream, buffer_size)将所有流的数据保存(复制)到指定的流。使用流的 StreamContainer.length 值。
save(destination_stream, buffer_size, length)将流的数据保存(复制)到指定的流。
save(file_path)将流的数据保存(复制)到指定的流。使用默认缓冲区大小 StreamContainer.READ_WRITE_BYTES_COUNT 和流的 StreamContainer.length 值。
save(file_path, buffer_size)将流的数据保存(复制)到指定的流。使用流的 StreamContainer.length 值。
save(file_path, buffer_size, length)将流的数据保存(复制)到指定的流。
save_to_stream(destination_stream)将流的数据保存(复制)到指定的流。使用默认缓冲区大小 StreamContainer.READ_WRITE_BYTES_COUNT 和流的 StreamContainer.length 值。
save_to_stream_with_buf_size(destination_stream, buffer_size)将所有流的数据保存(复制)到指定的流。使用流的 StreamContainer.length 值。
save_to_stream_with_buf_size_and_len(destination_stream, buffer_size, length)将流的数据保存(复制)到指定的流。
save_with_buf_size(file_path, buffer_size)将流的数据保存(复制)到指定的流。使用流的 StreamContainer.length 值。
save_with_buf_size_and_len(file_path, buffer_size, length)将流的数据保存(复制)到指定的流。
seek(offset, origin)设置当前流中的位置。
seek_begin()将流位置设置为流的起始位置。此值表示相对于在 StreamContainer 构造函数中传入的起始流位置的偏移量。
to_bytes()将流数据转换为 int 数组。
to_bytes(position, bytes_count)将流数据转换为 int 数组。
write(buffer, offset, count)将一系列字节写入当前流,并将此流中的当前位置向前移动已写入的字节数。
write(bytes)将所有指定的字节写入流。
write_byte(value)在流的当前位写入一个字节,并将流中的位置前移一个字节。
write_to(stream_container)将包含的数据复制到另一个 StreamContainer
write_to(stream_container, length)将包含的数据复制到另一个 StreamContainer

Constructor: StreamContainer(stream)

 StreamContainer(stream) 

初始化一个新的 StreamContainer 类实例。

Parameters:

参数TypeDescription
_io.BufferedRandom该流。

Constructor: StreamContainer(stream, dispose_stream)

 StreamContainer(stream, dispose_stream) 

初始化一个新的 StreamContainer 类实例。

Parameters:

参数TypeDescription
_io.BufferedRandom数据流。
dispose_streambool如果设置为 true,当容器被释放时流也将被释放。

Method: read(buffer, offset, count)

 read(buffer, offset, count) 

从当前流读取一系列字节,并将流中的位置前移读取的字节数。

Parameters:

参数TypeDescription
缓冲区System.Byte字节数组。当此方法返回时,缓冲区包含指定的字节数组,其中 offset 与 (offset + count - 1) 之间的值已被从当前源读取的字节替换。
offsetintbuffer 中开始存储从当前流读取的数据的基于零的字节偏移量。
countint从当前流读取的最大字节数。

Returns

TypeDescription
int读取到缓冲区的字节总数。如果当前可用字节不足请求的字节数,则可能少于请求的字节数;如果已到达流的末尾,则为零 (0)。

Method: read(bytes)

 read(bytes) 

读取字节以填充指定的字节缓冲区。

Parameters:

参数TypeDescription
字节System.Byte要填充的字节。

Returns

TypeDescription
int读取的字节数。如果流中的字节不足,则此值可能小于缓冲区中的字节数。

Method: read_byte()

 read_byte() 

从流中读取一个字节,并将流中的位置前移一个字节;如果已到达流的末尾,则返回 -1。

Returns

TypeDescription
int在流的末尾时,将无符号字节转换为 Int32,或返回 -1。

Method: save(destination_stream)

 save(destination_stream) 

将流的数据保存(复制)到指定的流。使用默认缓冲区大小 StreamContainer.READ_WRITE_BYTES_COUNT 和流的 StreamContainer.length 值。

Parameters:

参数TypeDescription
destination_stream_io.BufferedRandom用于保存数据的流。

Method: save(destination_stream, buffer_size)

 save(destination_stream, buffer_size) 

将所有流的数据保存(复制)到指定的流。使用流的 StreamContainer.length 值。

Parameters:

参数TypeDescription
destination_stream_io.BufferedRandom用于保存数据的流。
buffer_sizeint缓冲区。

Method: save(destination_stream, buffer_size, length)

 save(destination_stream, buffer_size, length) 

将流的数据保存(复制)到指定的流。

Parameters:

参数TypeDescription
destination_stream_io.BufferedRandom用于保存数据的流。
buffer_sizeint缓冲区大小。默认使用 StreamContainer.READ_WRITE_BYTES_COUNT 的值。
lengthint要复制的流数据长度。默认情况下,长度设置为 StreamContainer.length 的值。

Method: save(file_path)

 save(file_path) 

将流的数据保存(复制)到指定的流。使用默认缓冲区大小 StreamContainer.READ_WRITE_BYTES_COUNT 和流的 StreamContainer.length 值。

Parameters:

参数TypeDescription
file_pathstring用于保存流数据的文件路径。

Method: save(file_path, buffer_size)

 save(file_path, buffer_size) 

将流的数据保存(复制)到指定的流。使用流的 StreamContainer.length 值。

Parameters:

参数TypeDescription
file_pathstring用于保存流数据的文件路径。
buffer_sizeint缓冲区大小。默认使用 StreamContainer.READ_WRITE_BYTES_COUNT 的值。

Method: save(file_path, buffer_size, length)

 save(file_path, buffer_size, length) 

将流的数据保存(复制)到指定的流。

Parameters:

参数TypeDescription
file_pathstring用于保存流数据的文件路径。
buffer_sizeint缓冲区大小。默认使用 StreamContainer.READ_WRITE_BYTES_COUNT 的值。
lengthint要复制的流数据长度。默认情况下,长度设置为 StreamContainer.length 的值。

Method: save_to_stream(destination_stream)

 save_to_stream(destination_stream) 

将流的数据保存(复制)到指定的流。使用默认缓冲区大小 StreamContainer.READ_WRITE_BYTES_COUNT 和流的 StreamContainer.length 值。

Parameters:

参数TypeDescription
destination_stream_io.BufferedRandom用于保存数据的流。

Method: save_to_stream_with_buf_size(destination_stream, buffer_size)

 save_to_stream_with_buf_size(destination_stream, buffer_size) 

将所有流的数据保存(复制)到指定的流。使用流的 StreamContainer.length 值。

Parameters:

参数TypeDescription
destination_stream_io.BufferedRandom用于保存数据的流。
buffer_sizeint缓冲区。

Method: save_to_stream_with_buf_size_and_len(destination_stream, buffer_size, length)

 save_to_stream_with_buf_size_and_len(destination_stream, buffer_size, length) 

将流的数据保存(复制)到指定的流。

Parameters:

参数TypeDescription
destination_stream_io.BufferedRandom用于保存数据的流。
buffer_sizeint缓冲区大小。默认使用 StreamContainer.READ_WRITE_BYTES_COUNT 的值。
lengthint要复制的流数据长度。默认情况下,长度设置为 StreamContainer.length 的值。

Method: save_with_buf_size(file_path, buffer_size)

 save_with_buf_size(file_path, buffer_size) 

将流的数据保存(复制)到指定的流。使用流的 StreamContainer.length 值。

Parameters:

参数TypeDescription
file_pathstring用于保存流数据的文件路径。
buffer_sizeint缓冲区大小。默认使用 StreamContainer.READ_WRITE_BYTES_COUNT 的值。

Method: save_with_buf_size_and_len(file_path, buffer_size, length)

 save_with_buf_size_and_len(file_path, buffer_size, length) 

将流的数据保存(复制)到指定的流。

Parameters:

参数TypeDescription
file_pathstring用于保存流数据的文件路径。
buffer_sizeint缓冲区大小。默认使用 StreamContainer.READ_WRITE_BYTES_COUNT 的值。
lengthint要复制的流数据长度。默认情况下,长度设置为 StreamContainer.length 的值。

Method: seek(offset, origin)

 seek(offset, origin) 

设置当前流中的位置。

Parameters:

参数TypeDescription
offsetint相对于 origin 参数的字节偏移量。此值表示相对于在 StreamContainer 构造函数中传入的起始流位置的偏移量。
originSeekOriginSeekOrigin 类型的值,指示用于获取新位置的参考点。

Returns

TypeDescription
int当前流中的新位置。

Method: to_bytes()

 to_bytes() 

将流数据转换为 int 数组。

Returns

TypeDescription
System.Byte转换为 int 数组的流数据。

Method: to_bytes(position, bytes_count)

 to_bytes(position, bytes_count) 

将流数据转换为 int 数组。

Parameters:

参数TypeDescription
positionint开始读取字节的位置。
bytes_countint要读取的字节数。

Returns

TypeDescription
System.Byte转换为 int 数组的流数据。

Method: write(buffer, offset, count)

 write(buffer, offset, count) 

将一系列字节写入当前流,并将此流中的当前位置向前移动已写入的字节数。

Parameters:

参数TypeDescription
缓冲区System.Byte字节数组。此方法将 count 字节从 buffer 复制到当前流。
offsetintbuffer 中的零基字节偏移量,指示开始将字节复制到当前流的位置。
countint写入当前流的字节数。

Method: write(bytes)

 write(bytes) 

将所有指定的字节写入流。

Parameters:

参数TypeDescription
字节System.Byte要写入的字节。

Method: write_byte(value)

 write_byte(value) 

在流的当前位写入一个字节,并将流中的位置前移一个字节。

Parameters:

参数TypeDescription
valueSystem.Byte要写入流的字节。

Method: write_to(stream_container)

 write_to(stream_container) 

将包含的数据复制到另一个 StreamContainer

Parameters:

参数TypeDescription
stream_containerStreamContainer要复制到的流容器。

Method: write_to(stream_container, length)

 write_to(stream_container, length) 

将包含的数据复制到另一个 StreamContainer

Parameters:

参数TypeDescription
stream_containerStreamContainer要复制到的流容器。
lengthint要写入的字节数。