public class XTCEFunctions extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
bitSetToHex(BitSet bits,
int minBytes)
Convert a BitSet object to a hex byte string, ordered from the most
significant byte to the least significant byte.
|
static boolean |
checkLocaleAvailable(Locale userLocale)
Checks if a Locale preference is supported by this toolkit.
|
static String |
generalErrorPrefix()
Retrieves the internationalized version of the ERROR prefix used for
exception and log messages.
|
static String |
generalWarningPrefix()
Retrieves the internationalized version of the Warning prefix used for
exception and log messages.
|
static XTCEAbsoluteTimeType |
getAbsoluteTimeHandler(org.omg.space.xtce.AbsoluteTimeDataType element)
Method to locate a time handler for an XTCE AbsoluteTimeDataType
element.
|
static BitSet |
getBitSetFromByteArray(byte[] bytes)
This function converts a byte array to a BitSet suitable for use in the
container content processing when applying a binary data set.
|
static BitSet |
getBitSetFromStreamByteArray(byte[] bytes)
This function converts a byte array to a BitSet suitable for use in the
container content processing when applying a binary data set.
|
static byte[] |
getBytesFromHexString(String hex)
Retrieves a byte array from a hexadecimal stream represented by a
string.
|
static String |
getCleanHexString(String inputText)
Retrieve a "cleaned up" hex string from a user input hexadecimal field.
|
static String |
getMemoryUsageStatistics()
Creates a string with the current memory usage statistics from the
Java Virtual Machine.
|
static String |
getNameFromPathReferenceString(String filepath)
This function is for stripping off object name from an XTCE path
reference from the data model for containerRef, parameterRef, and
argumentRef, amongst others.
|
static String |
getPathNameFromReferenceString(String filepath)
This function is for stripping the path off an path reference in the
XTCE data model for containerRef, parameterRef, and argumentRef, amongst
others.
|
static byte[] |
getStreamByteArrayFromBitSet(BitSet rawBits,
int minBytes)
This function converts a BitSet from the encode functions to a byte
array in the order it would exist on the wire in that the zeroth index
is the first byte read/written.
|
static String |
getText(String key)
This function supports I18N and L10N for the XTCE toolkit by permitting
this class to maintain the statics for internationalization and making
it easy for calling code to get internationalized strings from anywhere.
|
static String |
makeAliasDisplayString(XTCENamedObject parameter,
boolean showAllNamespaces,
boolean showAliasNamespaces,
String preferredNamespace)
This function formats the aliases on a named and typed object based on
some preferences.
|
static String |
makeRepeatString(long count,
long total)
This function makes the repeat parameter/argument string, taking into
account the internationalization.
|
static boolean |
matchesUsingGlob(String text,
String glob)
A matcher function that uses the glob style algorithm to determine if
a candidate string matches a glob style pattern.
|
static void |
registerAbsoluteTimeHandler(XTCEAbsoluteTimeType instance)
Method to register a custom time handler for XTCE AbsoluteTimeDataType
elements.
|
static String |
resolvePathReference(String currentPath,
String pathReference)
This function mimics the behavior of the ubiquitous filesystem function
called realpath().
|
static boolean |
setLocalePreference(Locale userLocale)
Sets the user language and country preference so that a ResourceBundle
can be loaded to assist the getText() function.
|
static String |
xmlPrettyPrint(NodeList nodes)
Method to format and "beautify" the XML text from a provided DOM
NodeList object.
|
static String |
xmlPrettyPrint(String xmlText)
Method to format and "beautify" the XML text from a provided String
object containing XML ASCII text.
|
public static void registerAbsoluteTimeHandler(XTCEAbsoluteTimeType instance)
instance - Constructed object of a type that implements the
interface XTCEAbsoluteTimeType in toolkit.public static XTCEAbsoluteTimeType getAbsoluteTimeHandler(org.omg.space.xtce.AbsoluteTimeDataType element) throws XTCEDatabaseException
element - AbsoluteTimeDataType XML element from an XTCE document.XTCEDatabaseException - thrown in the event that a handler is not
available or not usable for this element.public static BitSet getBitSetFromByteArray(byte[] bytes)
bytes - byte[] array of raw binary data.public static byte[] getStreamByteArrayFromBitSet(BitSet rawBits, int minBytes)
rawBits - BitSet containing the raw binary data.minBytes - int containing the number of bytes expected. Sometimes
the BitSet can be short or long due to allocations.public static BitSet getBitSetFromStreamByteArray(byte[] bytes)
bytes - byte[] array of raw binary data.public static String bitSetToHex(BitSet bits, int minBytes)
bits - BitSet containing an arbitrarily long binary field.minBytes - integer containing the minimum number of bytes to output
on the hex string. This results in 0 padding if the BitSet is too
small.public static String resolvePathReference(String currentPath, String pathReference)
currentPath - The current working Space System path from which the
candidate path reference is to be resolved from.pathReference - The candidate path reference, generally from an
XTCE containerRef, parameterRef, or argumentRef.public static String getPathNameFromReferenceString(String filepath)
filepath - An XTCE style path reference string that contains the
Space System path leading up to the object of interest, such as a
Container, Parameter, or Argument, amongst others.public static String getNameFromPathReferenceString(String filepath)
filepath - An XTCE style path reference string that contains the
Space System path leading up to the object of interest, such as a
Container, Parameter, or Argument, amongst others.public static String makeAliasDisplayString(XTCENamedObject parameter, boolean showAllNamespaces, boolean showAliasNamespaces, String preferredNamespace)
parameter - XTCENamedObject containing any of the objects that can
be aliased in the XTCE data model and are supported by this toolkit.showAllNamespaces - boolean indicating if all of the namespaces
should appear in the string.showAliasNamespaces - boolean indicating if the alias names should
be included in the alias string.preferredNamespace - String containing the preferred namespace if
there is more than one defined.public static String getCleanHexString(String inputText)
inputText - String containing user input text.public static byte[] getBytesFromHexString(String hex)
hex - String containing the user provided hexadecimal string. It
is recommended to call the "getCleanHexString()" on this text first.NumberFormatException - if the string cannot be interpreted as a
hex string by the Java Integer class.public static boolean matchesUsingGlob(String text, String glob)
text - String containing the candidate text to match.glob - String containing the glob pattern, probably provided by a
user to match something from a list.public static String getText(String key)
key - String containing the key to lookup the desired text message
from the locale appropriate properties file.public static boolean setLocalePreference(Locale userLocale)
userLocale - Locale object containing the desired language and
country. A properties file is needed to support the choice.public static boolean checkLocaleAvailable(Locale userLocale)
userLocale - Locale to check to see if a bundle exists.public static String generalErrorPrefix()
public static String generalWarningPrefix()
public static String xmlPrettyPrint(NodeList nodes) throws XTCEDatabaseException
nodes - NodeList containing XML nodes to format into ASCII text.XTCEDatabaseException - thrown in the event that the Transformer
cannot convert the NodeList to XML text.public static String xmlPrettyPrint(String xmlText) throws XTCEDatabaseException
xmlText - String containing XML text.XTCEDatabaseException - thrown in the event that the Transformer
cannot convert the convert the ASCII text.public static String getMemoryUsageStatistics()
public static String makeRepeatString(long count, long total)
count - long containing the current item count.total - long total number of items.Copyright © 2015–2019. All rights reserved.