Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 20 Using TIBCO Object Service Broker SDK (Java) : Misc Object Methods

Misc Object Methods
commCreate
Creates a new byte array and formats it according to the commarea specification. The size of the new byte array is calculated based on the supplied segment structure. In the second form, the structure is assumed to have one segment of segmentSize bytes

 
public static byte[] commCreate(int[] segmentSizes)
or
public static byte[] commCreate(int segmentSize)

 
Parameters:
 
Return Value:
A new commarea byte array.
Exceptions
First form: OutOfMemoryError, NullPointerException.
Second form: OutOfMemoryError.
Comments
The part of the array that belongs to the segment bodies is not initialized.
commFormat
Formats a byte array according to the commarea specification.
In the second form, the commarea is assumed to contain one segment of segmentSize bytes.

 
public static void commFormat(byte[] area,
int[]  segmentSizes)
or
public static void commFormat(byte[] area,
int segmentSize)

 
Parameters:
 
Return Value:
None.
Exceptions
Since no verification of input parameters is performed, standard array access exceptions are thrown.
commSegmentInd
Returns the offset of a specified segment in a commarea.

 
public static int commSegmentInd(byte[] area,
int segmentNum)

 
Parameters:
 
Return Value:
The offset of the beginning of the segment body, or 0 if the segment does not exist.
Exceptions
Since no verification of input parameters is performed, standard array access exceptions are thrown.
commSegments
Returns the number of segments in a commarea according to its header.

 
public int commSegments(byte[] area)

 
Parameters:
 
Return Value:
The number of segments in a commarea according to its header.
Exceptions
Since no verification of input parameters is performed, standard array access exceptions are thrown.
commSegSize
Returns the size of a given commarea segment.

 
public int commSegSize(byte[] area,
int segmentNum)

 
Parameters:
 
Return Value:
The segment size, or 0 (zero) if the segment does not exist.
Exceptions
Since no verification of input parameters is performed, standard array access exceptions are thrown.
commSize
Calculates the number of bytes in a commarea according to its header.

 
public int commSize(byte[] area)

 
Parameters:
 
Return Value:
The total size of a commarea according to its header.
Exceptions
Since no verification of input parameters is performed, standard array access exceptions are thrown.
commSizeCalc
Calculates the number of bytes needed for a commarea with the specified structure.
This method has two forms:

 
public static int commSizeCalc(int[] segmentSizes)
or
 
public int commSizeCalc(int segmentSize)

 
In the first form, the commarea has a structure supplied by the input array.
In the second form, the commarea has one segment of a given size.
Parameters:
 
Return Value:
The size of an area with the supplied structure.
Exceptions
For the first form, since no verification of input parameters is performed, standard array access exceptions are thrown. The second form throws no exceptions.
readInt
Reads 4 bytes from a byte array and returns a value of type int according to what these bytes represent in big-endian format.

 
public static int readInt(byte[] b,
int offset)

 
Parameters:
 
Return Value:
The value of type int that the specified 4 bytes represent in big-endian format.
Exceptions
Since no verification of input parameters is performed, standard array access exceptions are thrown.
readShort
Reads 2 bytes from a byte array and returns a value of type short according to what these bytes represent in big-endian format.

 
public static short readShort(byte[] b,
int offset)

 
Parameters:
 
Return Value:
The value of type short that the specified 2 bytes represent in big-endian format.
Exceptions
Since no verification of input parameters is performed, standard array access exceptions are thrown.
writeInt
Writes, into a byte array, 4 bytes of a big-endian byte representation of a value of type int.

 
public static void writeInt(int n,
byte[] b,
int offset)

 
Parameters:
 
Return Value:
None.
Exceptions
Since no verification of input parameters is performed, standard array access exceptions are thrown.
writeShort
Writes, into a byte array, 2 bytes of a big-endian byte representation of a value of type short.

 
public static void writeShort(short  s,
byte[] b,
int offset)

 
Parameters:
 
Return Value:
None.
Exceptions
Since no verification of input parameters is performed, standard array access exceptions are thrown.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved