Package org.docx4j.utils
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.ByteBuffercreateByteBuffer(int capacity)static byte[]getBytesFromInputStream(java.io.InputStream is)static java.io.InputStreamnewInputStream(java.nio.ByteBuffer buf)Returns an input stream for a ByteBuffer.static java.nio.ByteBufferreadInputStream(java.io.InputStream in)Fully reads the given InputStream, returning its contents as a ByteBuffer
-
Constructor Details
-
BufferUtil
public BufferUtil()
-
-
Method Details
-
readInputStream
public static java.nio.ByteBuffer readInputStream(java.io.InputStream in) throws java.io.IOExceptionFully reads the given InputStream, returning its contents as a ByteBuffer- Parameters:
in- anInputStreamvalue- Returns:
- a
ByteBuffervalue - 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
-