Class BufferUtil

java.lang.Object
org.docx4j.utils.BufferUtil

public class BufferUtil
extends java.lang.Object
  • Constructor Summary

    Constructors 
    Constructor Description
    BufferUtil()  
  • Method Summary

    Modifier and Type Method Description
    static java.nio.ByteBuffer createByteBuffer​(int capacity)  
    static byte[] getBytesFromInputStream​(java.io.InputStream is)  
    static java.io.InputStream newInputStream​(java.nio.ByteBuffer buf)
    Returns an input stream for a ByteBuffer.
    static java.nio.ByteBuffer readInputStream​(java.io.InputStream in)
    Fully reads the given InputStream, returning its contents as a ByteBuffer

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • readInputStream

      public static java.nio.ByteBuffer readInputStream​(java.io.InputStream in) throws java.io.IOException
      Fully reads the given InputStream, returning its contents as a ByteBuffer
      Parameters:
      in - an InputStream value
      Returns:
      a ByteBuffer value
      Throws:
      java.io.IOException - if an error occurs
    • createByteBuffer

      public static java.nio.ByteBuffer createByteBuffer​(int capacity)
    • newInputStream

      public static java.io.InputStream newInputStream​(java.nio.ByteBuffer buf)
      Returns an input stream for a ByteBuffer. The read() methods use the relative ByteBuffer get() methods.
    • getBytesFromInputStream

      public static byte[] getBytesFromInputStream​(java.io.InputStream is) throws java.io.IOException
      Throws:
      java.io.IOException