org.opcfoundation.ua.utils.bytebuffer
Class ByteBufferWriteable

java.lang.Object
  extended by org.opcfoundation.ua.utils.bytebuffer.ByteBufferWriteable
All Implemented Interfaces:
IBinaryWriteable

public class ByteBufferWriteable
extends Object
implements IBinaryWriteable

IWriteable implementation with ByteBuffer as backend

Author:
Toni Kalajainen (toni.kalajainen@vtt.fi)

Constructor Summary
ByteBufferWriteable(ByteBuffer buf)
          Constructor for ByteBufferWriteable.
 
Method Summary
 void flush()
          flush.
 ByteOrder order()
          order.
 void order(ByteOrder order)
          order.
 long position()
          position.
 void position(long newPosition)
          position.
 void put(byte b)
          put.
 void put(byte[] src)
          put.
 void put(byte[] src, int offset, int length)
          put.
 void put(ByteBuffer src)
          Put n bytes from the remaining of the byte array.
 void put(ByteBuffer src, int length)
          Put n bytes from the remaining of the byte buffer.
 void putDouble(double value)
          putDouble.
 void putFloat(float value)
          putFloat.
 void putInt(int value)
          putInt.
 void putLong(long value)
          putLong.
 void putShort(short value)
          putShort.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteBufferWriteable

public ByteBufferWriteable(ByteBuffer buf)

Constructor for ByteBufferWriteable.

Parameters:
buf - a ByteBuffer object.
Method Detail

put

public void put(byte b)

put.

Specified by:
put in interface IBinaryWriteable
Parameters:
b - a byte.

put

public void put(ByteBuffer src)
Put n bytes from the remaining of the byte array. This operation moves the pointer in byte buffer.

Specified by:
put in interface IBinaryWriteable
Parameters:
src - a ByteBuffer object.

put

public void put(ByteBuffer src,
                int length)
Put n bytes from the remaining of the byte buffer. This operation moves the pointer in byte buffer.

Specified by:
put in interface IBinaryWriteable
Parameters:
src - a ByteBuffer object.
length - a int.

put

public void put(byte[] src,
                int offset,
                int length)

put.

Specified by:
put in interface IBinaryWriteable
Parameters:
src - an array of byte.
offset - a int.
length - a int.

put

public void put(byte[] src)

put.

Specified by:
put in interface IBinaryWriteable
Parameters:
src - an array of byte.

putDouble

public void putDouble(double value)

putDouble.

Specified by:
putDouble in interface IBinaryWriteable
Parameters:
value - a double.

putFloat

public void putFloat(float value)

putFloat.

Specified by:
putFloat in interface IBinaryWriteable
Parameters:
value - a float.

putInt

public void putInt(int value)

putInt.

Specified by:
putInt in interface IBinaryWriteable
Parameters:
value - a int.

putLong

public void putLong(long value)

putLong.

Specified by:
putLong in interface IBinaryWriteable
Parameters:
value - a long.

putShort

public void putShort(short value)

putShort.

Specified by:
putShort in interface IBinaryWriteable
Parameters:
value - a short.

order

public ByteOrder order()

order.

Specified by:
order in interface IBinaryWriteable
Returns:
a ByteOrder object.

order

public void order(ByteOrder order)

order.

Specified by:
order in interface IBinaryWriteable
Parameters:
order - a ByteOrder object.

flush

public void flush()

flush.

Specified by:
flush in interface IBinaryWriteable

position

public long position()
              throws IOException

position.

Returns:
a long.
Throws:
IOException - if any.

position

public void position(long newPosition)
              throws IOException

position.

Parameters:
newPosition - a long.
Throws:
IOException - if any.


Copyright © 2018. All rights reserved.