sdljava.util
Class BufferUtil
java.lang.Object
sdljava.util.BufferUtil
public class BufferUtil
- extends java.lang.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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BUFFER_SIZE
private static final int BUFFER_SIZE
- See Also:
- Constant Field Values
BufferUtil
public BufferUtil()
readURL
public static java.nio.ByteBuffer readURL(java.net.URL url)
throws java.io.IOException,
java.net.MalformedURLException
- 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:
java.io.IOException
- if an error occurs
java.net.MalformedURLException
- if an error occurs
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)
createByteBuffer
public static java.nio.ByteBuffer createByteBuffer(byte[] values)
createFloatBuffer
public static java.nio.FloatBuffer createFloatBuffer(int capacity)
createFloatBuffer
public static java.nio.FloatBuffer createFloatBuffer(float[] values)
createIntBuffer
public static java.nio.IntBuffer createIntBuffer(int capacity)
createIntBuffer
public static java.nio.IntBuffer createIntBuffer(int[] values)
createDoubleBuffer
public static java.nio.DoubleBuffer createDoubleBuffer(int capacity)
createDoubleBuffer
public static java.nio.DoubleBuffer createDoubleBuffer(double[] values)
createLongBuffer
public static java.nio.LongBuffer createLongBuffer(int capacity)
createLongBuffer
public static java.nio.LongBuffer createLongBuffer(long[] values)
createShortBuffer
public static java.nio.ShortBuffer createShortBuffer(int capacity)
createShortBuffer
public static java.nio.ShortBuffer createShortBuffer(short[] values)
createCharBuffer
public static java.nio.CharBuffer createCharBuffer(int capacity)
createCharBuffer
public static java.nio.CharBuffer createCharBuffer(char[] values)