MemoryStream

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 24 methods for working with MemoryStream objects in Java programs. Available methods include: MemoryStream, close, copyTo, flush, getBuffer, getInputStream, getLength, getOutputStream, getSize, read, readByte, seek, and 6 additional methods. All public members are accessible to any Java application after installing the Aspose.3D FOSS for Java package. Properties: SEEK_CURRENT, SEEK_END, SEEK_SET, buffer, inputStream, length, and 2 more.

Properties

NameTypeAccessDescription
sizeintReadGets the size of the data in the stream.
bufferbyte[]ReadGets the buffer.
lengthlongReadGets the length of the data in the stream.
inputStreamjava.io.InputStreamReadGets the input stream.
outputStreamjava.io.OutputStreamReadGets the output stream.
SEEK_SETintReadGets the seek set.
SEEK_CURRENTintReadGets the seek current.
SEEK_ENDintReadGets the seek end.

Methods

SignatureDescription
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()intGets the size of the data in the stream.
getBuffer()byte[]Gets the buffer.
setCapacity(cap: int)Sets the capacity of the stream.
getLength()longGets 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()intReads a byte from the stream.
read(buf: byte[])intReads bytes from the stream.
read(buf: byte[], start: int, len: int)intReads 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)longSeeks 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.
getInputStream()java.io.InputStreamReturns the input stream.
getOutputStream()java.io.OutputStreamReturns the output stream.
wrap(stream: OutputStream)StreamWrap an OutputStream as Stream, the stream must be closed to flush data to output stream.
wrap(stream: InputStream)StreamWrap an InputStream as Stream.

See Also

 English