|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.cotta.memory.ByteArrayBuffer
public class ByteArrayBuffer
Faster performing ByteArrayBuffer using the ByteArrayOutputStream as a backing up stream. Writes 400MB in 44 seconds. Requires approx 2x memory of the file size, eg for 400MB set -Xmx1024m.
Contributed by: Sergey Abramov http://coldcore.com
| Field Summary | |
|---|---|
static int |
INCREMENT
|
| Constructor Summary | |
|---|---|
ByteArrayBuffer()
|
|
ByteArrayBuffer(byte[] content)
|
|
ByteArrayBuffer(byte[] content,
int increament)
|
|
ByteArrayBuffer(int initialCapacity)
|
|
ByteArrayBuffer(int initialCapacity,
int increment)
|
|
| Method Summary | |
|---|---|
ByteArrayBuffer |
append(byte b)
|
ByteArrayBuffer |
append(byte[] b)
Faster performing method, output stream should delegate to it (comment above). |
ByteArrayBuffer |
append(byte[] b,
int off,
int len)
Faster performing method, output stream should delegate to it (comment above). |
void |
append(java.lang.String value)
This works for the default charset only: String str = ""+(char)1077+(char)1078; //UTF-8 System.out.println((int)str.charAt(0)); //1077 str = new String(str.getBytes(), "UTF-8"); System.out.println((int)str.charAt(0)); //63, no UTF-8 any longer |
void |
append(java.lang.String value,
java.lang.String charsetName)
This one converts to the proper charset. |
byte |
byteAt(int position)
|
byte |
byteAt(long position)
|
int |
copyFrom(java.nio.ByteBuffer src)
|
long |
copyTo(java.nio.ByteBuffer dst,
int start,
int count)
|
long |
copyTo(java.nio.channels.WritableByteChannel target,
long position,
long count)
|
int |
size()
|
byte[] |
toByteArray()
|
java.lang.String |
toString()
This method returns a string using the default charset. |
java.lang.String |
toString(java.lang.String charsetName)
This method returns a string converted to the proper charset. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int INCREMENT
| Constructor Detail |
|---|
public ByteArrayBuffer(byte[] content)
public ByteArrayBuffer(byte[] content,
int increament)
public ByteArrayBuffer()
public ByteArrayBuffer(int initialCapacity)
public ByteArrayBuffer(int initialCapacity,
int increment)
| Method Detail |
|---|
public byte[] toByteArray()
public ByteArrayBuffer append(byte b)
public ByteArrayBuffer append(byte[] b,
int off,
int len)
public ByteArrayBuffer append(byte[] b)
public void append(java.lang.String value)
throws java.io.IOException
java.io.IOException
public void append(java.lang.String value,
java.lang.String charsetName)
throws java.io.IOException
java.io.IOExceptionpublic byte byteAt(long position)
public byte byteAt(int position)
public int size()
public int copyFrom(java.nio.ByteBuffer src)
public long copyTo(java.nio.ByteBuffer dst,
int start,
int count)
public long copyTo(java.nio.channels.WritableByteChannel target,
long position,
long count)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Object
public java.lang.String toString(java.lang.String charsetName)
throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||