com.aspose.pdf

Interfaces

Classes

Enums

Exceptions

com.aspose.pdf

Class OptimizedMemoryStream

  • java.lang.Object
    • com.aspose.ms.System.IO.Stream
      • com.aspose.pdf.OptimizedMemoryStream
  • All Implemented Interfaces:
    com.aspose.ms.System.IDisposable


    public class OptimizedMemoryStream
    extends com.aspose.ms.System.IO.Stream

    Defines a MemoryStream that can contains more standard capacity

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static class  OptimizedMemoryStream.SeekOrigin
      Specifies the position in a stream to use for seeking.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int DefaultBufferSize 
      • Fields inherited from class com.aspose.ms.System.IO.Stream

        Null
    • Constructor Summary

      Constructors 
      Constructor and Description
      OptimizedMemoryStream()
      Initializes a new instance of the OptimizedMemoryStream class.
      OptimizedMemoryStream(byte[] buffer)
      Initializes a new instance of the OptimizedMemoryStream class based on the specified byte array.
      OptimizedMemoryStream(int bufferSize)
      Initializes a new instance of the OptimizedMemoryStream class.
      OptimizedMemoryStream(int bufferSize, byte[] buffer)
      Initializes a new instance of the OptimizedMemoryStream class based on the specified byte array.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean canRead()
      When overridden in a derived class, gets a value indicating whether the current stream supports reading.
      boolean canSeek()
      When overridden in a derived class, gets a value indicating whether the current stream supports seeking.
      boolean canWrite()
      When overridden in a derived class, gets a value indicating whether the current stream supports writing.
      void flush()
      The function overrided.
      int getBufferSize()
      Gets or sets the size of the underlying buffers.
      boolean getFreeOnDispose()
      Gets or sets a value indicating whether to free the underlying buffers on dispose.
      long getLength()
      When overridden in a derived class, gets the length in bytes of the stream.
      long getPosition()
      When overridden in a derived class, gets or sets the position within the current stream.
      int read(byte[] buffer, int offset, int count)
      When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
      int readByte()
      Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
      long seek(long offset, int origin)
      When overridden in a derived class, sets the position within the current stream.
      void setBufferSize(int value)
      Gets or sets the size of the underlying buffers.
      void setFreeOnDispose(boolean value)
      Gets or sets a value indicating whether to free the underlying buffers on dispose.
      void setLength(long value)
      When overridden in a derived class, sets the length of the current stream.
      void setPosition(long value)
      When overridden in a derived class, gets or sets the position within the current stream.
      byte[] toArray()
      Converts the current stream to a byte array.
      void write(byte[] buffer, int offset, int count)
      When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
      void writeByte(byte value)
      Writes a byte to the current position in the stream and advances the position within the stream by one byte.
      void writeTo(com.aspose.ms.System.IO.Stream stream)
      Writes to the specified stream.
      • Methods inherited from class com.aspose.ms.System.IO.Stream

        _synchronized, beginRead, beginWrite, canTimeout, close, copyTo, copyTo, dispose, endRead, endWrite, fromJava, getReadTimeout, getWriteTimeout, setReadTimeout, setWriteTimeout, toInputStream, toJava, toOutputStream
    • Constructor Detail

      • OptimizedMemoryStream

        public OptimizedMemoryStream()

        Initializes a new instance of the OptimizedMemoryStream class.

      • OptimizedMemoryStream

        public OptimizedMemoryStream(int bufferSize,
                                     byte[] buffer)

        Initializes a new instance of the OptimizedMemoryStream class based on the specified byte array.

        Parameters:
        bufferSize - Size of the underlying buffers.
        buffer - The array of unsigned bytes from which to create the current stream.
      • OptimizedMemoryStream

        public OptimizedMemoryStream(int bufferSize)

        Initializes a new instance of the OptimizedMemoryStream class.

        Parameters:
        bufferSize - Size of the underlying buffers.
      • OptimizedMemoryStream

        public OptimizedMemoryStream(byte[] buffer)

        Initializes a new instance of the OptimizedMemoryStream class based on the specified byte array.

        Parameters:
        buffer - The array of unsigned bytes from which to create the current stream.
    • Method Detail

      • canRead

        public boolean canRead()

        When overridden in a derived class, gets a value indicating whether the current stream supports reading.

        Specified by:
        canRead in class com.aspose.ms.System.IO.Stream
        Returns:
        true if the stream supports reading; otherwise, false. Value:
      • canSeek

        public boolean canSeek()

        When overridden in a derived class, gets a value indicating whether the current stream supports seeking.

        Specified by:
        canSeek in class com.aspose.ms.System.IO.Stream
        Returns:
        true if the stream supports seeking; otherwise, false. Value:
      • canWrite

        public boolean canWrite()

        When overridden in a derived class, gets a value indicating whether the current stream supports writing.

        Specified by:
        canWrite in class com.aspose.ms.System.IO.Stream
        Returns:
        true if the stream supports writing; otherwise, false. Value:
      • getBufferSize

        public final int getBufferSize()

        Gets or sets the size of the underlying buffers.

        Value: The buffers size.
        Returns:
        int value
      • setBufferSize

        public final void setBufferSize(int value)

        Gets or sets the size of the underlying buffers.

        Value: The buffers size.
        Parameters:
        value - int value
      • getLength

        public long getLength()

        When overridden in a derived class, gets the length in bytes of the stream.

        Specified by:
        getLength in class com.aspose.ms.System.IO.Stream
        Returns:
        A long value representing the length of the stream in bytes. Value:
      • getPosition

        public long getPosition()

        When overridden in a derived class, gets or sets the position within the current stream.

        Specified by:
        getPosition in class com.aspose.ms.System.IO.Stream
        Returns:
        The current position within the stream. Value:
      • setPosition

        public void setPosition(long value)

        When overridden in a derived class, gets or sets the position within the current stream.

        The current position within the stream. Value:
        Specified by:
        setPosition in class com.aspose.ms.System.IO.Stream
      • getFreeOnDispose

        public final boolean getFreeOnDispose()

        Gets or sets a value indicating whether to free the underlying buffers on dispose.

        Returns:
        boolean value
      • setFreeOnDispose

        public final void setFreeOnDispose(boolean value)

        Gets or sets a value indicating whether to free the underlying buffers on dispose.

        Parameters:
        value - boolean value
      • read

        public int read(byte[] buffer,
                        int offset,
                        int count)

        When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

        Specified by:
        read in class com.aspose.ms.System.IO.Stream
        Parameters:
        buffer - An array of bytes. When this method returns, the buffer contains the specified byte array with the values
        offset - The zero-based byte offset in at which to begin storing the data read from the current stream.
        count - The maximum number of bytes to be read from the current stream.
        Returns:
        The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.
      • readByte

        public int readByte()

        Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.

        Overrides:
        readByte in class com.aspose.ms.System.IO.Stream
        Returns:
        byte or -1 if at the end of the stream.
      • seek

        public long seek(long offset,
                         int origin)

        When overridden in a derived class, sets the position within the current stream.

        Specified by:
        seek in class com.aspose.ms.System.IO.Stream
        Parameters:
        offset - A byte offset relative to the origin parameter.
        origin - A value of type OptimizedMemoryStream.SeekOrigin indicating the reference point used to obtain the new position.
        Returns:
        The new position within the current stream.
      • flush

        public void flush()

        The function overrided.

        Specified by:
        flush in class com.aspose.ms.System.IO.Stream
      • setLength

        public void setLength(long value)

        When overridden in a derived class, sets the length of the current stream.

        Specified by:
        setLength in class com.aspose.ms.System.IO.Stream
        Parameters:
        value - The desired length of the current stream in bytes.
      • toArray

        public final byte[] toArray()

        Converts the current stream to a byte array.

        Returns:
        An array of bytes
      • write

        public void write(byte[] buffer,
                          int offset,
                          int count)

        When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

        Specified by:
        write in class com.aspose.ms.System.IO.Stream
        Parameters:
        buffer - An array of bytes. This method copies count bytes from buffer to the current stream.
        offset - The zero-based byte offset in buffer at which to begin copying bytes to the current stream.
        count - The number of bytes to be written to the current stream.
      • writeByte

        public void writeByte(byte value)

        Writes a byte to the current position in the stream and advances the position within the stream by one byte.

        Overrides:
        writeByte in class com.aspose.ms.System.IO.Stream
        Parameters:
        value - The byte to write to the stream.
      • writeTo

        public final void writeTo(com.aspose.ms.System.IO.Stream stream)

        Writes to the specified stream.

        Parameters:
        stream - The stream.