Class DocumentBlock

java.lang.Object
org.docx4j.org.apache.poi.poifs.storage.BigBlock
org.docx4j.org.apache.poi.poifs.storage.DocumentBlock
All Implemented Interfaces:
BlockWritable

public final class DocumentBlock extends BigBlock
A block of document data.
  • Field Details

    • _default_value

      private static final byte _default_value
      See Also:
    • _data

      private byte[] _data
    • _bytes_read

      private int _bytes_read
  • Constructor Details

    • DocumentBlock

      public DocumentBlock(RawDataBlock block) throws IOException
      create a document block from a raw data block
      Parameters:
      block - the raw data block
      Throws:
      IOException
    • DocumentBlock

      public DocumentBlock(InputStream stream, POIFSBigBlockSize bigBlockSize) throws IOException
      Create a single instance initialized with data.
      Parameters:
      stream - the InputStream delivering the data.
      Throws:
      IOException
    • DocumentBlock

      private DocumentBlock(POIFSBigBlockSize bigBlockSize)
      Create a single instance initialized with default values
  • Method Details

    • size

      public int size()
      Get the number of bytes read for this block
      Returns:
      bytes read into the block
    • partiallyRead

      public boolean partiallyRead()
      Was this a partially read block?
      Returns:
      true if the block was only partially filled with data
    • getFillByte

      public static byte getFillByte()
      Returns:
      the fill byte used
    • convert

      public static DocumentBlock[] convert(POIFSBigBlockSize bigBlockSize, byte[] array, int size)
      convert a single long array into an array of DocumentBlock instances
      Parameters:
      array - the byte array to be converted
      size - the intended size of the array (which may be smaller)
      Returns:
      an array of DocumentBlock instances, filled from the input array
    • getDataInputBlock

      public static DataInputBlock getDataInputBlock(DocumentBlock[] blocks, int offset)
    • writeData

      void writeData(OutputStream stream) throws IOException
      Write the block's data to an OutputStream
      Specified by:
      writeData in class BigBlock
      Parameters:
      stream - the OutputStream to which the stored data should be written
      Throws:
      IOException - on problems writing to the specified stream