sdljava.util

Class BufferUtil

public class BufferUtil extends Object

Some usefull methods for reading URLs or streams and returning the data as Direct Buffers

Version: $Id: BufferUtil.java,v 1.5 2005/02/19 02:00:36 ivan_ganza Exp $

Author: Ivan Z. Ganza Robert Schuster Bart LEBOEUF

Field Summary
static intBUFFER_SIZE
Method Summary
static ByteBuffercreateByteBuffer(int capacity)
static ByteBuffercreateByteBuffer(byte[] values)
static CharBuffercreateCharBuffer(int capacity)
static CharBuffercreateCharBuffer(char[] values)
static DoubleBuffercreateDoubleBuffer(int capacity)
static DoubleBuffercreateDoubleBuffer(double[] values)
static FloatBuffercreateFloatBuffer(int capacity)
static FloatBuffercreateFloatBuffer(float[] values)
static IntBuffercreateIntBuffer(int capacity)
static IntBuffercreateIntBuffer(int[] values)
static LongBuffercreateLongBuffer(int capacity)
static LongBuffercreateLongBuffer(long[] values)
static ShortBuffercreateShortBuffer(int capacity)
static ShortBuffercreateShortBuffer(short[] values)
static ByteBufferreadInputStream(InputStream in)
Fully reads the given InputStream, returning its contents as a ByteBuffer
static ByteBufferreadURL(URL url)
Tries to open the given URL, get its input stream, returns the data in a direct ByteBuffer

Field Detail

BUFFER_SIZE

private static final int BUFFER_SIZE

Method Detail

createByteBuffer

public static ByteBuffer createByteBuffer(int capacity)

createByteBuffer

public static ByteBuffer createByteBuffer(byte[] values)

createCharBuffer

public static CharBuffer createCharBuffer(int capacity)

createCharBuffer

public static CharBuffer createCharBuffer(char[] values)

createDoubleBuffer

public static DoubleBuffer createDoubleBuffer(int capacity)

createDoubleBuffer

public static DoubleBuffer createDoubleBuffer(double[] values)

createFloatBuffer

public static FloatBuffer createFloatBuffer(int capacity)

createFloatBuffer

public static FloatBuffer createFloatBuffer(float[] values)

createIntBuffer

public static IntBuffer createIntBuffer(int capacity)

createIntBuffer

public static IntBuffer createIntBuffer(int[] values)

createLongBuffer

public static LongBuffer createLongBuffer(int capacity)

createLongBuffer

public static LongBuffer createLongBuffer(long[] values)

createShortBuffer

public static ShortBuffer createShortBuffer(int capacity)

createShortBuffer

public static ShortBuffer createShortBuffer(short[] values)

readInputStream

public static ByteBuffer readInputStream(InputStream in)
Fully reads the given InputStream, returning its contents as a ByteBuffer

Parameters: in an InputStream value

Returns: a ByteBuffer value

Throws: IOException if an error occurs

readURL

public static ByteBuffer readURL(URL url)
Tries to open the given URL, get its input stream, returns the data in a direct ByteBuffer

Parameters: url an URL value

Returns: a ByteBuffer value with the contacts of the data present at URL

Throws: IOException if an error occurs MalformedURLException if an error occurs