Class RTFImageOutputStream

java.lang.Object
java.io.OutputStream
com.nomagic.magicreport.engine.rtf.RTFImageOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

@OpenApiAll public class RTFImageOutputStream extends OutputStream
The RTF image output stream.
  • Field Details

    • WMF_PLACEABLE_HEADER_SIZE

      public static final int WMF_PLACEABLE_HEADER_SIZE
      The number of WMF header length.
      See Also:
  • Constructor Details

    • RTFImageOutputStream

      public RTFImageOutputStream(Writer writer, String imageType)
      Create RTF image output stream.
      Parameters:
      writer - the stream to write the converted image
      imageType - target image type
  • Method Details

    • writeHex

      protected void writeHex(byte b) throws IOException
      Write hexadecimal string.
      Parameters:
      b - a byte
      Throws:
      IOException - when IO error occurred
    • write

      public void write(int b) throws IOException
      Writes the specified byte to this RTF image output stream.
      Specified by:
      write in class OutputStream
      Parameters:
      b - the byte to be written.
      Throws:
      IOException - if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.
    • write

      public void write(byte[] b, int off, int len) throws IOException
      Writes len bytes from the specified byte array starting at offset off to this byte RTF image output stream.
      Overrides:
      write in class OutputStream
      Parameters:
      b - the data.
      off - the start offset in the data.
      len - the number of bytes to write.
      Throws:
      IOException - if an I/O error occurs. In particular, an IOException may be thrown if the output stream has been closed.
    • getTotalWrittenChars

      public long getTotalWrittenChars()
      Return total characters has been written.
      Returns:
      the total written characters
    • close

      public void close() throws IOException
      Closes this output stream and releases any system resources associated with this stream. A closed stream cannot perform output operations and cannot be reopened.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class OutputStream
      Throws:
      IOException - if an I/O error occurs.