| java.lang.Object org.openlaszlo.iv.flash.util.Util
Util | public class Util (Code) | | Utility class.
author: Dmitry Skavish |
Method Summary | |
public static String | b2h(int v) | public static String | concatFileNames(String path, String name) Returns concatenation of path and filename. | public static String | d2h(int v) | public static String | decodeURLEncoded(String s) | public static int | double2fixed(double value) | public static int | double2twips(double value) | public static void | dump(byte[] buffer, int start, int size, PrintStream out) | public static String | executeJSFile(Context context, String fileName, String[] parms) | public static String | executeJSString(Context context, String js_text, String[] parms) | public static double | fixed2double(int value) | public static float | fixed2float(int value) | public static int | float2fixed(float value) | public static int | float2twips(float value) | public static LineReader | getArrayReader(FlashFile file, byte[] buf, int offset, int length) | public static int | getDWord(byte a, byte b, byte c, byte d) Creates signed dword from four bytes. | public static LineReader | getInputStreamReader(InputStream is, String encoding) | public static String | getInstallDir() | public static int | getMax(int[] arr, int size) Returns maximum element of array. | public static int | getMax(int[] arr) Returns maximum element of array. | public static int | getMax(int a, int b) Returns maximum of absolute values of two numbers. | public static int | getMax(int a, int b, int c) Returns maximum of absolute values of three numbers. | public static int | getMax(int a, int b, int c, int d) Returns maximum of absolute values of four numbers. | public static int | getMinBitsS(int v) Returns number of significant bits for signed integer. | public static int | getMinBitsU(int v) Returns number of significant bits for unsigned integer. | public static URL | getResource(String resource) | public static File | getSysFile(String name) Returns jgenerator file by its name. | public static int | getUByte(byte a) Converts byte to unsigned byte. | public static int | getUDWord(byte a, byte b, byte c, byte d) Creates unsigned dword from four bytes. | public static int | getUWord(byte a, byte b) Creates unsigned word from two bytes. | public static LineReader | getUrlReader(FlashFile file, IVUrl url) | public static String | getVersion() Returns version of JGenerator. | public static int | getWord(byte a, byte b) Creates signed word from two bytes. | public static boolean | hasVar(String s) Returns whether specified string has generator variable or not. | public static void | init() | public static void | init(String installDir, String propFileName) Initialize JGenerator. | public static void | init(String installDir) Initialize JGenerator. | public static boolean | isDefault(String s) | public static Object | newInstance(String className, Class[] parmsCls, Object[] parms) | public static Hashtable | parseUrlParms(String s, int idx) | public static String | processEscapes(String line) Processes escapes in the specified string.
Escapes to be processed:
- \n - newline
- \r - carriage return
- \0x...
| public static FlashBuffer | readUrl(IVUrl url) Reads data from specified url into FlashBuffer. | public static boolean | toBool(String v, boolean def) Converts specified string to boolean. | public static AlphaColor | toColor(String v, AlphaColor def) Converts specified string to color. | public static double | toDouble(String v, double def) Converts specified string to double. | public static int | toInt(String v, int def) Converts specified string to int. | public static long | toLong(String v, long def) Converts specified string to long. | public static char | toPrint(char ch) | public static URL | toURL(File file) Creates URL from specified file. | public static String | translatePath(String path) Translates file separator in the specified string into
file separator of the system jgenerator is running on. | public static double | twips2double(int value) | public static float | twips2float(int value) | public static String | w2h(int v) |
fileSeparator | public static char fileSeparator(Code) | | |
javaVersion | public static double javaVersion(Code) | | |
pathSeparator | public static char pathSeparator(Code) | | |
b2h | public static String b2h(int v)(Code) | | Returns hexadecimal representation of specified byte
Parameters: v - specified byte hex repsentation of specified byte |
concatFileNames | public static String concatFileNames(String path, String name)(Code) | | Returns concatenation of path and filename.
Parameters: path - path Parameters: name - filename concatenation of specified path and specified filename |
d2h | public static String d2h(int v)(Code) | | Returns hexadecimal representation of specified dword
Parameters: v - specified dword hex repsentation of specified dword |
decodeURLEncoded | public static String decodeURLEncoded(String s)(Code) | | Decodes url-encoded string
Parameters: s - url-encoded string decoded string |
double2fixed | public static int double2fixed(double value)(Code) | | Converts double to fixed value
Parameters: value - double value fixed value |
double2twips | public static int double2twips(double value)(Code) | | Converts double to twips
Parameters: value - double value twips value |
dump | public static void dump(byte[] buffer, int start, int size, PrintStream out)(Code) | | Prints hex dump of part of byte array to specified stream
Parameters: buffer - buffer to be dumped Parameters: start - offset in the buffer to start the dump from Parameters: size - size of the dumped area Parameters: out - stream to print the dump to |
executeJSFile | public static String executeJSFile(Context context, String fileName, String[] parms)(Code) | | Executes specified javascript file in given Context
Parameters: context - specified context Parameters: js_text - javascript text Parameters: parms - parameters for javascript result of "printing" in javascript |
executeJSString | public static String executeJSString(Context context, String js_text, String[] parms)(Code) | | Executes specified javascript text in given Context
Parameters: context - specified context Parameters: js_text - javascript text Parameters: parms - parameters for javascript result of "printing" in javascript |
fixed2double | public static double fixed2double(int value)(Code) | | Converts fixed Flash value into double
Parameters: value - fixed Flash value double value |
fixed2float | public static float fixed2float(int value)(Code) | | Converts fixed Flash value into float
Parameters: value - fixed Flash value float value |
float2fixed | public static int float2fixed(float value)(Code) | | Converts float to fixed value
Parameters: value - float value fixed value |
float2twips | public static int float2twips(float value)(Code) | | Converts float to twips
Parameters: value - float value twips value |
getArrayReader | public static LineReader getArrayReader(FlashFile file, byte[] buf, int offset, int length) throws IOException(Code) | | Returns Reader of specified String using encoding from specified FlashFile
Parameters: file - file Parameters: buf - buffer Parameters: offset - offset in the buffer Parameters: length - buffer length reader exception: IOException - |
getDWord | public static int getDWord(byte a, byte b, byte c, byte d)(Code) | | Creates signed dword from four bytes.
Parameters: a - 0 byte (low) Parameters: b - 1 byte Parameters: c - 2 byte Parameters: d - 3 byte (high) signed dword |
getInputStreamReader | public static LineReader getInputStreamReader(InputStream is, String encoding) throws IOException(Code) | | Returns BufferedReader of specified InputStream and encoding
Parameters: is - input stream Parameters: encoding - encoding (may be null) reader |
getInstallDir | public static String getInstallDir()(Code) | | Returns directory where jgenerator is installed
directory where jgenerator is installed |
getMax | public static int getMax(int[] arr, int size)(Code) | | Returns maximum element of array.
Parameters: arr - array to be searched for maximum Parameters: size - size of the array maximim element of the array |
getMax | public static int getMax(int[] arr)(Code) | | Returns maximum element of array.
Parameters: arr - array to be searched for maximum maximim element of the array |
getMax | public static int getMax(int a, int b)(Code) | | Returns maximum of absolute values of two numbers.
Parameters: a - specified number Parameters: b - specified number maximum of two numbers |
getMax | public static int getMax(int a, int b, int c)(Code) | | Returns maximum of absolute values of three numbers.
Parameters: a - specified number Parameters: b - specified number Parameters: c - specified number maximum of three numbers |
getMax | public static int getMax(int a, int b, int c, int d)(Code) | | Returns maximum of absolute values of four numbers.
Parameters: a - specified number Parameters: b - specified number Parameters: c - specified number Parameters: d - specified number maximum of four specified numbers |
getMinBitsS | public static int getMinBitsS(int v)(Code) | | Returns number of significant bits for signed integer.
Parameters: v - signed integer number of significant bits for signed integer |
getMinBitsU | public static int getMinBitsU(int v)(Code) | | Returns number of significant bits for unsigned integer.
Parameters: v - unsigned integer number of significant bits for unsigned integer |
getResource | public static URL getResource(String resource)(Code) | | Gets resource's URL
Parameters: resource - resource name resource URL |
getSysFile | public static File getSysFile(String name)(Code) | | Returns jgenerator file by its name.
If name is relative returns absolute path constructing
with
Util.installDir and the specified name
Parameters: name - file name jgenerator absolute file |
getUByte | public static int getUByte(byte a)(Code) | | Converts byte to unsigned byte.
|
getUDWord | public static int getUDWord(byte a, byte b, byte c, byte d)(Code) | | Creates unsigned dword from four bytes.
Parameters: a - 0 byte (low) Parameters: b - 1 byte Parameters: c - 2 byte Parameters: d - 3 byte (high) unsigned dword |
getUWord | public static int getUWord(byte a, byte b)(Code) | | Creates unsigned word from two bytes.
Parameters: a - low byte Parameters: b - high byte unsigned word |
getUrlReader | public static LineReader getUrlReader(FlashFile file, IVUrl url) throws IOException(Code) | | Returns Reader of specified IVUrl using encoding either
from specified IVUrl or specified FlashFile
Parameters: file - file Parameters: url - url Reader |
getVersion | public static String getVersion()(Code) | | Returns version of JGenerator.
version of JGenerator |
getWord | public static int getWord(byte a, byte b)(Code) | | Creates signed word from two bytes.
Parameters: a - low byte Parameters: b - high byte signed word |
hasVar | public static boolean hasVar(String s)(Code) | | Returns whether specified string has generator variable or not.
Parameters: s - string to be searched for generator variable true if the specified string has generator variable |
init | public static void init()(Code) | | Initialize JGenerator
Usually you need to call this method from standalone applications only
|
init | public static void init(String installDir, String propFileName)(Code) | | Initialize JGenerator.
Sets installation directory and reads and caches some
basic properties and iv.properties file
Parameters: installDir - jgenerator installation directory Parameters: propFileName - iv.properties file name |
init | public static void init(String installDir)(Code) | | Initialize JGenerator.
Sets installation directory and reads and caches some
basic properties and iv.properties file
Parameters: installDir - jgenerator installation directory |
isDefault | public static boolean isDefault(String s)(Code) | | Returns true if the specified string is "default" in some language
Parameters: s - string to be tested for "default" true if the specified string is "default" |
newInstance | public static Object newInstance(String className, Class[] parmsCls, Object[] parms) throws Exception(Code) | | Creates new instance of an specified class
Parameters: className - specified class name Parameters: parmsCls - parameters types of constructor Parameters: parms - parameters of constructor new instance exception: Exception - |
parseUrlParms | public static Hashtable parseUrlParms(String s, int idx)(Code) | | Parses parameters of url-string begining after the specified index (usually index of '?')
Parameters are pairs: name=value, separated by ampersand
Parameters: s - url Parameters: idx - specified index hashtable of parameter exception: IVException - |
processEscapes | public static String processEscapes(String line)(Code) | | Processes escapes in the specified string.
Escapes to be processed:
- \n - newline
- \r - carriage return
- \0x... - hex value
- \0... - octal value
Parameters: line - string to be processed escape-processed string |
toBool | public static boolean toBool(String v, boolean def)(Code) | | Converts specified string to boolean.
Parameters: v - string to be converted Parameters: def - default value to be used if there are some problems during conversion boolean value |
toColor | public static AlphaColor toColor(String v, AlphaColor def)(Code) | | Converts specified string to color.
Parameters: v - string to be converted Parameters: def - default value to be used if there are some problems during conversion color |
toDouble | public static double toDouble(String v, double def)(Code) | | Converts specified string to double.
Parameters: v - string to be converted Parameters: def - default value to be used if there are some problems during conversion double value |
toInt | public static int toInt(String v, int def)(Code) | | Converts specified string to int.
Parameters: v - string to be converted Parameters: def - default value to be used if there are some problems during conversion int value |
toLong | public static long toLong(String v, long def)(Code) | | Converts specified string to long.
Parameters: v - string to be converted Parameters: def - default value to be used if there are some problems during conversion long value |
toPrint | public static char toPrint(char ch)(Code) | | Returns specified char if it's printable or '.'
Parameters: ch - char to be converted to printable char printable char |
translatePath | public static String translatePath(String path)(Code) | | Translates file separator in the specified string into
file separator of the system jgenerator is running on.
Parameters: path - path to be translated translated path |
twips2double | public static double twips2double(int value)(Code) | | Converts twips to double
Parameters: value - twips value double value |
twips2float | public static float twips2float(int value)(Code) | | Converts twips to float
Parameters: value - twips value float value |
w2h | public static String w2h(int v)(Code) | | Returns hexadecimal representation of specified word
Parameters: v - specified word hex repsentation of specified word |
|
|