|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.simantics.databoard.util.binary.Blob
public class Blob
Blob represents a part of a larger random access binary. Blob is isolated random access binary, modifications, insertions and removals of bytes outside the represented bytes do not affect the blob. Insertions and removals of bytes to the parent do affect the blob, its start index, length and pointer are changed.
A backend must not be wrapped in a blob more than once.
Grow, Shrink, Insertion, and Removal affects child blobs if affected region intersects with a child. Grow, Shrink, Insertion, and Removal affects parent. It updates parent length, and start positions of the following (not preceding) siblings.
Constructor Summary | |
---|---|
Blob(RandomAccessBinary parent)
Create a sub-blob to a random access binary. |
|
Blob(RandomAccessBinary parent,
long start,
long length)
Create a sub-blob to a random access binary. |
Method Summary | |
---|---|
void |
close()
Flush and close the blob. |
Blob |
createSubBlob(long start,
long length)
|
void |
flush()
Flush write buffer |
byte |
get()
|
void |
get(byte[] dst)
|
void |
get(byte[] dst,
int offset,
int length)
|
void |
get(java.nio.ByteBuffer buf)
Get buf fully |
void |
get(java.nio.ByteBuffer buf,
int length)
Get fully length bytes |
double |
getDouble()
|
float |
getFloat()
|
int |
getInt()
|
long |
getLong()
|
RandomAccessBinary |
getParent()
|
short |
getShort()
|
RandomAccessBinary |
getSource()
|
long |
getStartPositionInSourceBinary()
|
void |
insertBytes(long bytes)
Insert bytes at current pointer. |
long |
length()
Get the length of the binary object. |
java.nio.ByteOrder |
order()
Get byte order |
void |
order(java.nio.ByteOrder order)
Set a new byte order |
long |
position()
Get the position of the cursor |
void |
position(long newPosition)
Set new cursor position. |
void |
put(byte b)
Write a byte |
void |
put(byte[] src)
|
void |
put(byte[] src,
int offset,
int length)
|
void |
put(java.nio.ByteBuffer src)
Put n bytes from the remaining of the byte array. |
void |
put(java.nio.ByteBuffer src,
int length)
Put n bytes from the remaining of the byte buffer. |
void |
putDouble(double value)
|
void |
putFloat(float value)
|
void |
putInt(int value)
|
void |
putLong(long value)
|
void |
putShort(short value)
|
void |
removeBytes(long bytes)
Remove bytes at pointer. |
void |
setLength(long newLength)
Modify the size of the blob. |
void |
setPositionInSource(long start,
long length)
|
void |
skip(long bytes)
Move pointer forward |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Blob(RandomAccessBinary parent) throws java.io.IOException
parent
-
java.io.IOException
public Blob(RandomAccessBinary parent, long start, long length)
parent
- start
- length
- Method Detail |
---|
public Blob createSubBlob(long start, long length)
public RandomAccessBinary getParent()
public void close() throws java.io.IOException
RandomAccessBinary
close
in interface RandomAccessBinary
java.io.IOException
public void insertBytes(long bytes) throws java.io.IOException
RandomAccessBinary
insertBytes
in interface RandomAccessBinary
java.io.IOException
public void removeBytes(long bytes) throws java.io.IOException
removeBytes
in interface RandomAccessBinary
bytes
-
java.io.IOException
public void setLength(long newLength) throws java.io.IOException
setLength
in interface RandomAccessBinary
newLength
- new number of bytes
java.io.IOException
public RandomAccessBinary getSource()
public void flush() throws java.io.IOException
RandomAccessBinary
flush
in interface BinaryWriteable
flush
in interface RandomAccessBinary
java.io.IOException
public java.nio.ByteOrder order()
RandomAccessBinary
order
in interface BinaryReadable
order
in interface BinaryWriteable
order
in interface RandomAccessBinary
public void order(java.nio.ByteOrder order)
RandomAccessBinary
order
in interface BinaryReadable
order
in interface BinaryWriteable
order
in interface RandomAccessBinary
order
- new byte orderpublic void put(byte b) throws java.io.IOException
RandomAccessBinary
put
in interface BinaryWriteable
put
in interface RandomAccessBinary
java.io.IOException
public void put(java.nio.ByteBuffer src) throws java.io.IOException
RandomAccessBinary
put
in interface BinaryWriteable
put
in interface RandomAccessBinary
java.io.IOException
public void put(java.nio.ByteBuffer src, int length) throws java.io.IOException
RandomAccessBinary
put
in interface BinaryWriteable
put
in interface RandomAccessBinary
java.io.IOException
public void put(byte[] src, int offset, int length) throws java.io.IOException
put
in interface BinaryWriteable
put
in interface RandomAccessBinary
java.io.IOException
public void put(byte[] src) throws java.io.IOException
put
in interface BinaryWriteable
put
in interface RandomAccessBinary
java.io.IOException
public void putDouble(double value) throws java.io.IOException
putDouble
in interface BinaryWriteable
putDouble
in interface RandomAccessBinary
java.io.IOException
public void putFloat(float value) throws java.io.IOException
putFloat
in interface BinaryWriteable
putFloat
in interface RandomAccessBinary
java.io.IOException
public void putInt(int value) throws java.io.IOException
putInt
in interface BinaryWriteable
putInt
in interface RandomAccessBinary
java.io.IOException
public void putLong(long value) throws java.io.IOException
putLong
in interface BinaryWriteable
putLong
in interface RandomAccessBinary
java.io.IOException
public void putShort(short value) throws java.io.IOException
putShort
in interface BinaryWriteable
putShort
in interface RandomAccessBinary
java.io.IOException
public byte get() throws java.io.IOException
get
in interface BinaryReadable
get
in interface RandomAccessBinary
java.io.IOException
public void get(byte[] dst, int offset, int length) throws java.io.IOException
get
in interface BinaryReadable
get
in interface RandomAccessBinary
java.io.IOException
public void get(byte[] dst) throws java.io.IOException
get
in interface BinaryReadable
get
in interface RandomAccessBinary
java.io.IOException
public void get(java.nio.ByteBuffer buf) throws java.io.IOException
RandomAccessBinary
get
in interface BinaryReadable
get
in interface RandomAccessBinary
java.io.IOException
public void get(java.nio.ByteBuffer buf, int length) throws java.io.IOException
RandomAccessBinary
get
in interface BinaryReadable
get
in interface RandomAccessBinary
java.io.IOException
public double getDouble() throws java.io.IOException
getDouble
in interface BinaryReadable
getDouble
in interface RandomAccessBinary
java.io.IOException
public float getFloat() throws java.io.IOException
getFloat
in interface BinaryReadable
getFloat
in interface RandomAccessBinary
java.io.IOException
public int getInt() throws java.io.IOException
getInt
in interface BinaryReadable
getInt
in interface RandomAccessBinary
java.io.IOException
public long getLong() throws java.io.IOException
getLong
in interface BinaryReadable
getLong
in interface RandomAccessBinary
java.io.IOException
public short getShort() throws java.io.IOException
getShort
in interface BinaryReadable
getShort
in interface RandomAccessBinary
java.io.IOException
public long length() throws java.io.IOException
RandomAccessBinary
length
in interface BinaryReadable
length
in interface RandomAccessBinary
java.io.IOException
public long position() throws java.io.IOException
RandomAccessBinary
position
in interface BinaryReadable
position
in interface RandomAccessBinary
java.io.IOException
public void position(long newPosition) throws java.io.IOException
RandomAccessBinary
position
in interface RandomAccessBinary
java.io.IOException
public void skip(long bytes) throws java.io.IOException
RandomAccessBinary
skip
in interface BinaryReadable
skip
in interface RandomAccessBinary
java.io.IOException
public long getStartPositionInSourceBinary()
public java.lang.String toString()
toString
in class java.lang.Object
public void setPositionInSource(long start, long length)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |