FileDocCategorySizeDatePackage
BufferFactory.javaAPI DocAndroid 1.5 API6752Wed May 06 22:41:04 BST 2009java.nio

BufferFactory

public final class BufferFactory extends Object
Provide factory service of buffer classes.

Since all buffer impl classes are package private (except DirectByteBuffer), this factory is the only entrance to access buffer functions from outside of the impl package.

Fields Summary
Constructors Summary
Methods Summary
public static java.nio.ByteBuffernewByteBuffer(byte[] array)
Returns a new byte buffer based on the specified byte array.

param
array The byte array
return
A new byte buffer based on the specified byte array.

        return new ReadWriteHeapByteBuffer(array);
    
public static java.nio.ByteBuffernewByteBuffer(int capacity)
Returns a new array based byte buffer with the specified capacity.

param
capacity The capacity of the new buffer
return
A new array based byte buffer with the specified capacity.

        return new ReadWriteHeapByteBuffer(capacity);
    
public static java.nio.CharBuffernewCharBuffer(char[] array)
Returns a new char buffer based on the specified char array.

param
array The char array
return
A new char buffer based on the specified char array.

        return new ReadWriteCharArrayBuffer(array);
    
public static java.nio.CharBuffernewCharBuffer(java.lang.CharSequence chseq)
Returns a new readonly char buffer based on the specified char sequence.

param
chseq The char sequence
return
A new readonly char buffer based on the specified char sequence.

        return new CharSequenceAdapter(chseq);
    
public static java.nio.CharBuffernewCharBuffer(int capacity)
Returns a new array based char buffer with the specified capacity.

param
capacity The capacity of the new buffer
return
A new array based char buffer with the specified capacity.

        return new ReadWriteCharArrayBuffer(capacity);
    
public static java.nio.ByteBuffernewDirectByteBuffer(int capacity)
Returns a new direct byte buffer with the specified capacity.

param
capacity The capacity of the new buffer
return
A new direct byte buffer with the specified capacity.

        return new ReadWriteDirectByteBuffer(capacity);
    
public static java.nio.DoubleBuffernewDoubleBuffer(double[] array)
Returns a new double buffer based on the specified double array.

param
array The double array
return
A new double buffer based on the specified double array.

        return new ReadWriteDoubleArrayBuffer(array);
    
public static java.nio.DoubleBuffernewDoubleBuffer(int capacity)
Returns a new array based double buffer with the specified capacity.

param
capacity The capacity of the new buffer
return
A new array based double buffer with the specified capacity.

        return new ReadWriteDoubleArrayBuffer(capacity);
    
public static java.nio.FloatBuffernewFloatBuffer(int capacity)
Returns a new array based float buffer with the specified capacity.

param
capacity The capacity of the new buffer
return
A new array based float buffer with the specified capacity.

        return new ReadWriteFloatArrayBuffer(capacity);
    
public static java.nio.FloatBuffernewFloatBuffer(float[] array)
Returns a new float buffer based on the specified float array.

param
array The float array
return
A new float buffer based on the specified float array.

        return new ReadWriteFloatArrayBuffer(array);
    
public static java.nio.IntBuffernewIntBuffer(int capacity)
Returns a new array based int buffer with the specified capacity.

param
capacity The capacity of the new buffer
return
A new array based int buffer with the specified capacity.

        return new ReadWriteIntArrayBuffer(capacity);
    
public static java.nio.IntBuffernewIntBuffer(int[] array)
Returns a new int buffer based on the specified int array.

param
array The int array
return
A new int buffer based on the specified int array.

        return new ReadWriteIntArrayBuffer(array);
    
public static java.nio.LongBuffernewLongBuffer(int capacity)
Returns a new array based long buffer with the specified capacity.

param
capacity The capacity of the new buffer
return
A new array based long buffer with the specified capacity.

        return new ReadWriteLongArrayBuffer(capacity);
    
public static java.nio.LongBuffernewLongBuffer(long[] array)
Returns a new long buffer based on the specified long array.

param
array The long array
return
A new long buffer based on the specified long array.

        return new ReadWriteLongArrayBuffer(array);
    
public static java.nio.ShortBuffernewShortBuffer(int capacity)
Returns a new array based short buffer with the specified capacity.

param
capacity The capacity of the new buffer
return
A new array based short buffer with the specified capacity.

        return new ReadWriteShortArrayBuffer(capacity);
    
public static java.nio.ShortBuffernewShortBuffer(short[] array)
Returns a new short buffer based on the specified short array.

param
array The short array
return
A new short buffer based on the specified short array.

        return new ReadWriteShortArrayBuffer(array);