com.amx.duet.tools.io
Interface IBinaryMarshall

All Known Subinterfaces:
IStruct
All Known Implementing Classes:
Marshall

public interface IBinaryMarshall

The IMarshall interface provides a structure for creating other marshalled objects. It provides standard error values, standard marshalled byte types, and standard data sizes. It also provides a binaryEncode() and a binaryDecode() method, which give users access to marshalled and unmarshalled data implemented by instances of this interface.

The mashalled and unmarshalled data should contained within the implementing object. Accessors to this data are left to user discretion.

 public class MarshalledObject implements IMarshall
 {
 	private Object data = null;
 	
 	public int binaryEncode(ObjectRef buffer, ObjectRef rPos)
 	{
 		// Take the values stored in data
 		// Encode them
 		// Pass the values back to buffer
 	}
 	public int binaryDecode(ObjectRef buffer, ObjectRef rPos)
 	{
 		// Take the value from buffer
 		// Decode it
 		// Store the values in data
 	}
 	public Object getData()
 	{
 		return data;
 	}
 }
 

Since:
AMXTools 1.0.0
Version:
1.0.0

Field Summary
static byte SIZE_CHAR
           
static byte SIZE_DWORD
           
static byte SIZE_QWORD
           
static byte SIZE_WORD
           
static int STV_DECODE_DATA_INCOMPLETE
           
static int STV_DECODE_DATA_TOO_SMALL
           
static int STV_DECODE_EOS
           
static int STV_DECODE_OBJECT_TOO_SMALL
           
static int STV_DECODE_OK
           
static int STV_DECODE_VARIABLE_MISMATCH
           
static int STV_ENCODE_BUFFER_TOO_SMALL
           
static int STV_ENCODE_OK
           
static int STV_ENCODE_VARIABLE_UNKNOWN
           
static byte TYPE_ARRAY
           
static byte TYPE_CHAR
           
static byte TYPE_CHAR_ARRAY
           
static byte TYPE_DWORD
           
static byte TYPE_DWORD_ARRAY
           
static byte TYPE_LONG_CHAR_ARRAY
           
static byte TYPE_QWORD
           
static byte TYPE_QWORD_ARRAY
           
static byte TYPE_SKIP
           
static byte TYPE_STRUCT_END
           
static byte TYPE_STRUCT_START
           
static byte TYPE_WORD
           
static byte TYPE_WORD_ARRAY
           
 
Method Summary
 int binaryDecode(ObjectRef buffer, ObjectRef rPos)
          The binaryDecode function decodes binary data passed in and places it into an internal set of values.
 int binaryEncode(ObjectRef buffer, ObjectRef rPos)
          The binaryEncode function encodes the internal set of values and places them in a single binary value.
 

Field Detail

STV_DECODE_EOS

public static final int STV_DECODE_EOS
See Also:
Constant Field Values

STV_DECODE_OK

public static final int STV_DECODE_OK
See Also:
Constant Field Values

STV_DECODE_VARIABLE_MISMATCH

public static final int STV_DECODE_VARIABLE_MISMATCH
See Also:
Constant Field Values

STV_DECODE_DATA_INCOMPLETE

public static final int STV_DECODE_DATA_INCOMPLETE
See Also:
Constant Field Values

STV_DECODE_DATA_TOO_SMALL

public static final int STV_DECODE_DATA_TOO_SMALL
See Also:
Constant Field Values

STV_DECODE_OBJECT_TOO_SMALL

public static final int STV_DECODE_OBJECT_TOO_SMALL
See Also:
Constant Field Values

STV_ENCODE_OK

public static final int STV_ENCODE_OK
See Also:
Constant Field Values

STV_ENCODE_VARIABLE_UNKNOWN

public static final int STV_ENCODE_VARIABLE_UNKNOWN
See Also:
Constant Field Values

STV_ENCODE_BUFFER_TOO_SMALL

public static final int STV_ENCODE_BUFFER_TOO_SMALL
See Also:
Constant Field Values

TYPE_CHAR

public static final byte TYPE_CHAR
See Also:
Constant Field Values

TYPE_WORD

public static final byte TYPE_WORD
See Also:
Constant Field Values

TYPE_DWORD

public static final byte TYPE_DWORD
See Also:
Constant Field Values

TYPE_QWORD

public static final byte TYPE_QWORD
See Also:
Constant Field Values

TYPE_CHAR_ARRAY

public static final byte TYPE_CHAR_ARRAY
See Also:
Constant Field Values

TYPE_WORD_ARRAY

public static final byte TYPE_WORD_ARRAY
See Also:
Constant Field Values

TYPE_DWORD_ARRAY

public static final byte TYPE_DWORD_ARRAY
See Also:
Constant Field Values

TYPE_QWORD_ARRAY

public static final byte TYPE_QWORD_ARRAY
See Also:
Constant Field Values

TYPE_LONG_CHAR_ARRAY

public static final byte TYPE_LONG_CHAR_ARRAY
See Also:
Constant Field Values

TYPE_STRUCT_START

public static final byte TYPE_STRUCT_START
See Also:
Constant Field Values

TYPE_STRUCT_END

public static final byte TYPE_STRUCT_END
See Also:
Constant Field Values

TYPE_ARRAY

public static final byte TYPE_ARRAY
See Also:
Constant Field Values

TYPE_SKIP

public static final byte TYPE_SKIP
See Also:
Constant Field Values

SIZE_CHAR

public static final byte SIZE_CHAR
See Also:
Constant Field Values

SIZE_WORD

public static final byte SIZE_WORD
See Also:
Constant Field Values

SIZE_DWORD

public static final byte SIZE_DWORD
See Also:
Constant Field Values

SIZE_QWORD

public static final byte SIZE_QWORD
See Also:
Constant Field Values
Method Detail

binaryEncode

public int binaryEncode(ObjectRef buffer,
                        ObjectRef rPos)
The binaryEncode function encodes the internal set of values and places them in a single binary value.

Parameters:
rPos - Must be of type long. This is where the first byte of the encoding is placed. It is also modified to point to the next location after the last encoded byte. That means that successive calls to this function can be made without modifying position. Position should be set to 0 on the first call.

Create rPos with a valueOf(long) Example:
ObjectRef rPos = new ObjectRef((long)0) or rPos.valueOf((long)0)

Returns:
  • 0 Encoded OK
  • -1 Encoded variable unrecognized type
  • -2 Encoded data would not fit into buffer, buffer too small

binaryDecode

public int binaryDecode(ObjectRef buffer,
                        ObjectRef rPos)
The binaryDecode function decodes binary data passed in and places it into an internal set of values.

Parameters:
rPos - Must be of type long. This is where the first byte of the decode data. Is it also modified to point to the next location after the last decoded byte. That means that successive calls to this function can be made without modifying position. Position should be set to 0 on the first call.

Create rPos with a valueOf(long) Example:
ObjectRef rPos = new ObjectRef((long)0) or rPos.valueOf((long)0)

Returns:
  • 2 - Decode data to small, more members in structure
  • 1 - Structure to small, more members in decode string
  • 0 - Decoded OK
  • -1 - Decode variable type mismatch
  • -2 - Decode data too small, decoder ran out of data


Copyright © 2008 AMX LLC. All Rights Reserved.