org.mapdb
Class DataOutput2
java.lang.Object
java.io.OutputStream
org.mapdb.DataOutput2
- All Implemented Interfaces:
- Closeable, DataOutput, Flushable
public final class DataOutput2
- extends OutputStream
- implements DataOutput
Provides DataOutput implementation on top of growable byte[]
ByteArrayOutputStream is not used as it requires byte[] copying
- Author:
- Jan Kotek
|
Field Summary |
byte[] |
buf
|
int |
pos
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
buf
public byte[] buf
pos
public volatile int pos
DataOutput2
public DataOutput2()
DataOutput2
public DataOutput2(byte[] buf)
copyBytes
public byte[] copyBytes()
ensureAvail
public void ensureAvail(int n)
- make sure there will be enought space in buffer to write N bytes
write
public void write(int b)
throws IOException
- Specified by:
write in interface DataOutput- Specified by:
write in class OutputStream
- Throws:
IOException
write
public void write(byte[] b)
throws IOException
- Specified by:
write in interface DataOutput- Overrides:
write in class OutputStream
- Throws:
IOException
write
public void write(byte[] b,
int off,
int len)
throws IOException
- Specified by:
write in interface DataOutput- Overrides:
write in class OutputStream
- Throws:
IOException
writeBoolean
public void writeBoolean(boolean v)
throws IOException
- Specified by:
writeBoolean in interface DataOutput
- Throws:
IOException
writeByte
public void writeByte(int v)
throws IOException
- Specified by:
writeByte in interface DataOutput
- Throws:
IOException
writeShort
public void writeShort(int v)
throws IOException
- Specified by:
writeShort in interface DataOutput
- Throws:
IOException
writeChar
public void writeChar(int v)
throws IOException
- Specified by:
writeChar in interface DataOutput
- Throws:
IOException
writeInt
public void writeInt(int v)
throws IOException
- Specified by:
writeInt in interface DataOutput
- Throws:
IOException
writeLong
public void writeLong(long v)
throws IOException
- Specified by:
writeLong in interface DataOutput
- Throws:
IOException
writeFloat
public void writeFloat(float v)
throws IOException
- Specified by:
writeFloat in interface DataOutput
- Throws:
IOException
writeDouble
public void writeDouble(double v)
throws IOException
- Specified by:
writeDouble in interface DataOutput
- Throws:
IOException
writeBytes
public void writeBytes(String s)
throws IOException
- Specified by:
writeBytes in interface DataOutput
- Throws:
IOException
writeChars
public void writeChars(String s)
throws IOException
- Specified by:
writeChars in interface DataOutput
- Throws:
IOException
writeUTF
public void writeUTF(String s)
throws IOException
- Specified by:
writeUTF in interface DataOutput
- Throws:
IOException
packLong
public static void packLong(DataOutput out,
long value)
throws IOException
- Pack non-negative long into output stream.
It will occupy 1-10 bytes depending on value (lower values occupy smaller space)
This method originally comes from Kryo Framework, author Nathan Sweet.
It was modified to fit MapDB needs.
- Parameters:
out - DataOutput to put value intovalue - to be serialized, must be non-negative
- Throws:
IOException
packInt
public static void packInt(DataOutput in,
int value)
throws IOException
- Pack non-negative long into output stream.
It will occupy 1-5 bytes depending on value (lower values occupy smaller space)
This method originally comes from Kryo Framework, author Nathan Sweet.
It was modified to fit MapDB needs.
- Parameters:
in - DataOutput to put value intovalue - to be serialized, must be non-negative
- Throws:
IOException
Copyright © 2014. All Rights Reserved.