Package loci.poi.hpsf

Class TypeWriter

java.lang.Object
loci.poi.hpsf.TypeWriter

public class TypeWriter extends Object

Class for writing little-endian data and more.

Since:
2003-02-20
Version:
$Id: TypeWriter.java 489730 2006-12-22 19:18:16Z bayard $
Author:
Rainer Klute <klute@rainer-klute.de>
  • Constructor Details

    • TypeWriter

      public TypeWriter()
  • Method Details

    • writeToStream

      public static int writeToStream(OutputStream out, short n) throws IOException

      Writes a two-byte value (short) to an output stream.

      Parameters:
      out - The stream to write to.
      n - The value to write.
      Returns:
      The number of bytes that have been written.
      Throws:
      IOException - if an I/O error occurs
    • writeToStream

      public static int writeToStream(OutputStream out, int n) throws IOException

      Writes a four-byte value to an output stream.

      Parameters:
      out - The stream to write to.
      n - The value to write.
      Returns:
      The number of bytes written to the output stream.
      Throws:
      IOException - if an I/O error occurs
    • writeToStream

      public static int writeToStream(OutputStream out, long n) throws IOException

      Writes a eight-byte value to an output stream.

      Parameters:
      out - The stream to write to.
      n - The value to write.
      Returns:
      The number of bytes written to the output stream.
      Throws:
      IOException - if an I/O error occurs
    • writeUShortToStream

      public static void writeUShortToStream(OutputStream out, int n) throws IOException

      Writes an unsigned two-byte value to an output stream.

      Parameters:
      out - The stream to write to
      n - The value to write
      Throws:
      IOException - if an I/O error occurs
    • writeUIntToStream

      public static int writeUIntToStream(OutputStream out, long n) throws IOException

      Writes an unsigned four-byte value to an output stream.

      Parameters:
      out - The stream to write to.
      n - The value to write.
      Returns:
      The number of bytes that have been written to the output stream.
      Throws:
      IOException - if an I/O error occurs
    • writeToStream

      public static int writeToStream(OutputStream out, ClassID n) throws IOException

      Writes a 16-byte ClassID to an output stream.

      Parameters:
      out - The stream to write to
      n - The value to write
      Returns:
      The number of bytes written
      Throws:
      IOException - if an I/O error occurs
    • writeToStream

      public static void writeToStream(OutputStream out, Property[] properties, int codepage) throws IOException, UnsupportedVariantTypeException

      Writes an array of Property instances to an output stream according to the Horrible Property Stream Format.

      Parameters:
      out - The stream to write to
      properties - The array to write to the stream
      codepage - The codepage number to use for writing strings
      Throws:
      IOException - if an I/O error occurs
      UnsupportedVariantTypeException - if HPSF does not support some variant type.
    • writeToStream

      public static int writeToStream(OutputStream out, double n) throws IOException

      Writes a double value value to an output stream.

      Parameters:
      out - The stream to write to.
      n - The value to write.
      Returns:
      The number of bytes written to the output stream.
      Throws:
      IOException - if an I/O error occurs