MemoryStream
Overview
MemoryStream is a class in Aspose.3D FOSS for Java.
Inherits from: Stream, AutoCloseable.
Memory stream for reading and writing data in memory.
This class provides 23 methods for working with MemoryStream objects in Java programs.
Available methods include: MemoryStream, Stream, close, copyTo, flush, getBuffer, getInputStream, getLength, getOutputStream, getSize, read, readByte, and 6 additional methods.
All public members are accessible to any Java application after installing the Aspose.3D FOSS for Java package.
Properties: buffer, inputStream, length, outputStream, size.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
size | int | Read | Gets the size of the data in the stream. |
buffer | byte[] | Read | Gets the buffer. |
length | long | Read | Gets the length of the data in the stream. |
outputStream | OutputStream | Read | Gets the output stream. |
inputStream | java.io.InputStream | Read | Gets the input stream. |
Methods
| Signature | Description |
|---|---|
MemoryStream() | Creates a new memory stream with default capacity. |
MemoryStream(capacity: int) | Creates a new memory stream with specified capacity. |
MemoryStream(data: byte[]) | Creates a new memory stream from existing data. |
getSize() → int | Gets the size of the data in the stream. |
getBuffer() → byte[] | Gets the buffer. |
setCapacity(cap: int) | Sets the capacity of the stream. |
getLength() → long | Gets the length of the data in the stream. |
setLength(len: long) | Sets the length of the stream. |
flush() | Flushes the stream (no-op for memory stream). |
readByte() → int | Reads a byte from the stream. |
read(buf: byte[]) → int | Reads bytes from the stream. |
read(buf: byte[], start: int, len: int) → int | Reads bytes from the stream. |
write(buf: byte[]) | Writes bytes to the stream. |
write(buf: byte[], start: int, len: int) | Writes bytes to the stream. |
writeByte(b: int) | Writes a byte to the stream. |
seek(offset: long, seek: int) → long | Seeks to a position in the stream. |
toArray() → byte[] | Converts the stream to an array. |
close() | Closes the stream. |
copyTo(stream: Stream) | Copies the stream content to another stream. |
copyTo(stream: OutputStream) | Copies the stream content to an output stream. |
Stream(in: InputStream) | File stream for reading and writing files. |
getOutputStream() → OutputStream | Returns the output stream. |
getInputStream() → java.io.InputStream | Creates a new file stream. |