morfologik.util
Class BufferUtils

java.lang.Object
  extended by morfologik.util.BufferUtils

public final class BufferUtils
extends java.lang.Object

Utility functions for buffers.


Method Summary
static java.nio.ByteBuffer ensureCapacity(java.nio.ByteBuffer buffer, int capacity)
          Ensure the byte buffer's capacity.
static java.nio.CharBuffer ensureCapacity(java.nio.CharBuffer buffer, int capacity)
          Ensure the char buffer's capacity.
static java.lang.String toString(java.nio.ByteBuffer sequence)
          Convert a byte buffer to a string in platform default encoding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

ensureCapacity

public static java.nio.ByteBuffer ensureCapacity(java.nio.ByteBuffer buffer,
                                                 int capacity)
Ensure the byte buffer's capacity. If a new buffer is allocated, its content is empty (the old buffer's contents is not copied).

Parameters:
buffer - The buffer to check or null if a new buffer should be allocated.

ensureCapacity

public static java.nio.CharBuffer ensureCapacity(java.nio.CharBuffer buffer,
                                                 int capacity)
Ensure the char buffer's capacity. If a new buffer is allocated, its content is empty (the old buffer's contents is not copied).

Parameters:
buffer - The buffer to check or null if a new buffer should be allocated.

toString

public static java.lang.String toString(java.nio.ByteBuffer sequence)
Convert a byte buffer to a string in platform default encoding.