public class MessageUtil extends Message
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BUNDLE_MESSAGE
key used to extract generic String message from Bundle.
|
static java.lang.String |
BUNDLE_PROPERTIES
key used to extract serialized Properties object from Bundle.
|
static java.lang.String |
BUNDLE_SMALL_PARCEL_ID
key used to extract from Bundle a String value, which is message's ID
it is used when transferring a message by a few parcels |
static java.lang.String |
BUNDLE_SMALL_PARCEL_INDEX
key used to extract from Bundle an int value, which is the index of parcels of a message
it is used when transferring a message by a few parcels |
static java.lang.String |
BUNDLE_SMALL_PARCEL_TOTALNUMBER
key used to extract from Bundle an int value, which indicates the total number of
parcels of a whole message to be sent. it is used when transferring a message by a few parcels |
static java.lang.String |
BUNDLE_SMALL_RESENT_PARCEL
key used to extract from Bundle an boolean value, which indicates if this parcel
is sent again or not by 'message-sender'. it is used when transferring a message by a few parcels |
static int |
ID_ALL_PARCELS_ACKNOWLEDGMENT
If the message's size is bigger than 262144 bytes,
the message will be divided into small parcels. |
static int |
ID_ENGINE_DEBUG
Client: local app is sending a debug message.
|
static int |
ID_ENGINE_DISPATCHFILE
Server: Notify local app a File is available for processing.
|
static int |
ID_ENGINE_DISPATCHPROPS
Server: Notify local app a serialized Properties Object is available for processing.
|
static int |
ID_ENGINE_EXCEPTION
Client: local app is sending an Exception message.
|
static int |
ID_ENGINE_MESSAGE
Client: local app is sending a generic Message.
|
static int |
ID_ENGINE_READY
Client: local app is Ready to receive commands.
|
static int |
ID_ENGINE_RESULT
Client: local app is returning simple processing results: (statuscode, statusinfo).
|
static int |
ID_ENGINE_RESULTPROPS
Client: local app is returning a serialized Properties object containing results.
|
static int |
ID_ENGINE_RUNNING
Client: local app is Running/Processing the File or Properties dispatched.
|
static int |
ID_ENGINE_SHUTDOWN
Server: a remote TCP client has requested a shutdown.
|
static int |
ID_PARCEL_ACKNOWLEDGMENT
If the message's size is bigger than 262144 bytes,
the message will be divided into small parcels. |
static int |
ID_REGISTER_ENGINE
Client: Register the local app client.
|
static int |
ID_SERVER_CONNECTED
Server: a remote TCP client has connected.
|
static int |
ID_SERVER_DISCONNECTED
Server: a remote TCP client has disconnected.
|
static int |
ID_SERVER_SHUTDOWN
Server: the service is shutting down abnormally and will not be available.
|
static int |
ID_UNREGISTER_ENGINE
Client: UnRegister the local app client.
|
static int |
MAX_TRANSFER_BYTE_SIZE
This field defines the max size can be transfered through Message Service in SAFS.
|
static java.lang.String |
SERVICE_CONNECT_INTENT |
static java.lang.String |
SERVICE_SHUTDOWN_INTENT |
static int |
SMALL_TRANSFER_BYTE_SIZE
This field defines the block's size to be transfered, if the whole message's size
is bigger than 262144 it is used when transferring a message by a few parcels |
KEY_ISREMOTERESULT, KEY_REMOTERESULTCODE, KEY_REMOTERESULTINFO, msg_connected, msg_debug, msg_dispatchfile, msg_dispatchprops, msg_exception, msg_message, msg_ready, msg_remoteshutdown, msg_result, msg_resultprops, msg_running, msg_sep, msg_shutdown, NULL_VALUE, shutdown_cause_controller, shutdown_cause_device, shutdown_cause_normal, shutdown_cause_service, STATUS_REMOTE_NOT_EXECUTED, STATUS_REMOTE_NOT_EXECUTED_STRING, STATUS_REMOTERESULT_FAIL, STATUS_REMOTERESULT_FAIL_STRING, STATUS_REMOTERESULT_OK, STATUS_REMOTERESULT_OK_STRING, STATUS_REMOTERESULT_UNKNOWN, STATUS_REMOTERESULT_UNKNOWN_STRING, STATUS_REMOTERESULT_WARN, STATUS_REMOTERESULT_WARN_STRING
Constructor and Description |
---|
MessageUtil() |
Modifier and Type | Method and Description |
---|---|
static android.os.Bundle |
addParcelableResentParcelFromSmallParcel(android.os.Parcelable parcelable,
boolean isResent) |
static android.os.Parcelable |
assembleParcelMessage(android.os.Parcelable one,
android.os.Parcelable another)
Concatenate two Parcelable Bundles containing String to form one Parcelable.
The String message is stored via Bundle.putCharArray using BUNDLE_MESSAGE as the key for the item. |
static android.os.Parcelable |
assembleParcelProps(android.os.Parcelable one,
android.os.Parcelable another)
Concatenate two Parcelable Bundles containing char[] to form one Parcelable.
The char[] message is stored via Bundle.putCharArray using BUNDLE_PROPERTIES as the key for the item. |
static java.lang.String |
getParcelableIDFromSmallParcel(android.os.Parcelable parcelable)
Extract a String received from the test package engine.
|
static int |
getParcelableIndexFromSmallParcel(android.os.Parcelable parcelable)
Extract a int received from the test package engine.
|
static java.lang.String |
getParcelableMessage(android.os.Parcelable parcelable)
Extract the String message received from the test package engine.
|
static char[] |
getParcelableProps(android.os.Parcelable parcelable)
Extract a char[] received from the test package engine.
|
static boolean |
getParcelableResentParcelFromSmallParcel(android.os.Parcelable parcelable) |
static int |
getParcelableTotalNumberFromSmallParcel(android.os.Parcelable parcelable)
Extract an int received from the test package engine.
|
static boolean |
isSmallParcelOfWholeMessage(android.os.Bundle dataBundle)
Test is the bundle contains the information of small parcel of a whole message.
|
static android.os.Bundle |
setBundleOfSmallParcel(java.lang.String ID,
int index,
int totalNumber)
Create a Parcelable Bundle containing 3 parameters: String, int, int for transport from the test package engine.
It will be used by Message.setData(Bundle) for sending a part of whole message from engine.The String message is stored via Bundle.putCharArray using BUNDLE_SMALL_PARCEL_ID as the key for the item.The int message is stored via Bundle.putCharArray using BUNDLE_SMALL_PARCEL_INDEX as the key for the item.The int message is stored via Bundle.putCharArray using BUNDLE_SMALL_PARCEL_TOTALNUMBER as the key for the item. |
static android.os.Parcelable |
setParcelableMessage(java.lang.String message)
Create a Parcelable Bundle containing a String message for transport to the test package engine.
|
static android.os.Parcelable |
setParcelableProps(char[] bytes)
Create a Parcelable Bundle containing a char[] for transport to the test package engine.
|
getStackTrace
public static final int ID_SERVER_SHUTDOWN
public static final int ID_REGISTER_ENGINE
public static final int ID_UNREGISTER_ENGINE
public static final int ID_ENGINE_READY
public static final int ID_ENGINE_DISPATCHFILE
public static final int ID_ENGINE_DISPATCHPROPS
public static final int ID_ENGINE_RUNNING
public static final int ID_ENGINE_RESULT
public static final int ID_ENGINE_RESULTPROPS
public static final int ID_ENGINE_MESSAGE
public static final int ID_ENGINE_DEBUG
public static final int ID_ENGINE_EXCEPTION
public static final int ID_SERVER_CONNECTED
public static final int ID_SERVER_DISCONNECTED
public static final int ID_ENGINE_SHUTDOWN
public static final int ID_ALL_PARCELS_ACKNOWLEDGMENT
public static final int ID_PARCEL_ACKNOWLEDGMENT
public static final java.lang.String BUNDLE_MESSAGE
public static final java.lang.String BUNDLE_PROPERTIES
public static final java.lang.String SERVICE_CONNECT_INTENT
public static final java.lang.String SERVICE_SHUTDOWN_INTENT
public static final int MAX_TRANSFER_BYTE_SIZE
Android Message: The Binder transaction buffer has a limited fixed size, currently 1Mb, which is shared by all transactions in progress for the process. Consequently TransactionTooLargeException can be thrown when there are many transactions in progress even when most of the individual transactions are of moderate size.
So the real max size of data can be transfered is always smaller than that 1Mb. Here we just give 0.25Mb as the max size to be permitted to transfer. But this also may cause TransactionTooLargeException if a lot of transactions is in progress. In future, we may adjust this value dynamically?
it is used to decide if a message should be transferred by a few parcelspublic static final int SMALL_TRANSFER_BYTE_SIZE
public static final java.lang.String BUNDLE_SMALL_PARCEL_ID
public static final java.lang.String BUNDLE_SMALL_PARCEL_INDEX
public static final java.lang.String BUNDLE_SMALL_PARCEL_TOTALNUMBER
public static final java.lang.String BUNDLE_SMALL_RESENT_PARCEL
public static android.os.Parcelable setParcelableMessage(java.lang.String message)
BUNDLE_MESSAGE
as the key for the item.message
- to send across processes.BaseBundle.putString(String, String)
,
BaseBundle.getString(String)
public static android.os.Parcelable setParcelableProps(char[] bytes)
BUNDLE_PROPERTIES
as the key for the item.
The original intent here is to store Java Properties in the Bundle that were serialized via
the Java Properties.store method.char[]
- (Properties) to send across processes.Bundle.putCharArray(String, char[])
,
Bundle.getCharArray(String)
public static android.os.Bundle setBundleOfSmallParcel(java.lang.String ID, int index, int totalNumber)
Message.setData(Bundle)
for sending a part of whole message from engine.BUNDLE_SMALL_PARCEL_ID
as the key for the item.BUNDLE_SMALL_PARCEL_INDEX
as the key for the item.BUNDLE_SMALL_PARCEL_TOTALNUMBER
as the key for the item.ID
- String, the message's ID.index
- int, the index of this parcel of the whole message.totalNumber
- int, indicate the total number of parcels will be sent for a whole message..Bundle.putCharArray(String, char[])
,
Bundle.getCharArray(String)
,
getParcelableIDFromSmallParcel(Parcelable)
,
getParcelableIndexFromSmallParcel(Parcelable)
,
getParcelableTotalNumberFromSmallParcel(Parcelable)
,
isSmallParcelOfWholeMessage(Bundle)
public static android.os.Bundle addParcelableResentParcelFromSmallParcel(android.os.Parcelable parcelable, boolean isResent)
public static boolean isSmallParcelOfWholeMessage(android.os.Bundle dataBundle)
dataBundle,
- Bundle, get from the data property of a Message object.setBundleOfSmallParcel(String, int, int)
,
getParcelableIDFromSmallParcel(Parcelable)
,
getParcelableIndexFromSmallParcel(Parcelable)
,
getParcelableTotalNumberFromSmallParcel(Parcelable)
public static java.lang.String getParcelableMessage(android.os.Parcelable parcelable)
BUNDLE_MESSAGE
as the key for the item.Parcelable
- Bundle received from the TCP Messenger Service.BaseBundle.putString(String, String)
,
BaseBundle.getString(String)
public static char[] getParcelableProps(android.os.Parcelable parcelable)
BUNDLE_PROPERTIES
as the key for the item.
The original intent here is to retrieve Java Properties stored as a char[] suitable for deserialization
via the Java Properties.load method.Parcelable
- Bundle received from the test package engineBundle.putCharArray(String, char[])
,
Bundle.getCharArray(String)
public static java.lang.String getParcelableIDFromSmallParcel(android.os.Parcelable parcelable)
BUNDLE_SMALL_PARCEL_ID
as the key for the item.Parcelable
- Bundle received from the test package engineBundle.putCharArray(String, char[])
,
Bundle.getCharArray(String)
,
setBundleOfSmallParcel(String, int, int)
public static int getParcelableIndexFromSmallParcel(android.os.Parcelable parcelable)
BUNDLE_SMALL_PARCEL_INDEX
as the key for the item.Parcelable
- Bundle received from the test package engineBundle.putCharArray(String, char[])
,
Bundle.getCharArray(String)
,
setBundleOfSmallParcel(String, int, int)
public static int getParcelableTotalNumberFromSmallParcel(android.os.Parcelable parcelable)
BUNDLE_SMALL_PARCEL_TOTALNUMBER
as the key for the item.Parcelable
- Bundle received from the test package engineBundle.putCharArray(String, char[])
,
Bundle.getCharArray(String)
,
setBundleOfSmallParcel(String, int, int)
public static boolean getParcelableResentParcelFromSmallParcel(android.os.Parcelable parcelable)
public static android.os.Parcelable assembleParcelMessage(android.os.Parcelable one, android.os.Parcelable another)
BUNDLE_MESSAGE
as the key for the item.one
- Parcelable Bundle, containing String messageanother
- Parcelable Bundle, containing String messageBundle.putCharArray(String, char[])
,
Bundle.getCharArray(String)
public static android.os.Parcelable assembleParcelProps(android.os.Parcelable one, android.os.Parcelable another)
BUNDLE_PROPERTIES
as the key for the item.one
- Parcelable Bundle, containing char[] messageanother
- Parcelable Bundle, containing char[] messageBundle.putCharArray(String, char[])
,
Bundle.getCharArray(String)
Copyright © SAS Institute. All Rights Reserved.