|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--iaik.me.utils.SysUtil
Constructor Summary | |
SysUtil()
The default constructor. |
Method Summary | |
static Reader |
getLineReader(Reader reader)
In case of the J2SE it turns the Reader into a BufferedReader. |
static Writer |
getLineWriter(Writer writer)
In case of the J2SE it turns the Writer into a PrintWriter. |
static SysUtil |
getSysUtil()
Returns the currently used SysUtil class. |
static boolean |
loadLibrary(String libraryName)
Loads a native code library. |
static void |
nextBytes(Random random,
byte[] data)
Returns an array of random bytes, the CLDC spec. defines only functions for int- and long type arrays. |
static InputStream |
openFileInputStream(String filename)
Opens an InputStream to a given file. |
static OutputStream |
openFileOutputStream(String filename)
Opens an OutputStream to a given file. |
static InputStream |
openURLInputStream(String protocolAndFilename)
Opens an InputStream to a resource with a given URL. |
static OutputStream |
openURLOutputStream(String protocolAndFilename)
Opens an OutputStream to a resource with a given URL. |
static void |
printLine(Writer writer)
Writes a carriage return into the stream. |
static void |
printLine(Writer writer,
String msg)
Writes a string with the specified writer. |
static String |
readLine(Reader reader)
Reads a line from an inputstream with a specific Reader. |
static void |
setSysUtil(String className)
Manually sets a specific SysUtil class that is used for fileoperations etc. |
static void |
setSysUtil(SysUtil sysUtilParam)
Manually sets a specific SysUtil class that is used for fileoperations etc. |
abstract Reader |
spiGetLineReader(Reader reader)
|
abstract Writer |
spiGetLineWriter(Writer writer)
|
abstract boolean |
spiLoadLibrary(String libraryName)
|
abstract void |
spiNextBytes(Random random,
byte[] data)
|
abstract InputStream |
spiOpenFileInputStream(String filename)
|
abstract OutputStream |
spiOpenFileOutputStream(String filename)
|
abstract InputStream |
spiOpenURLInputStream(String filename)
|
abstract OutputStream |
spiOpenURLOutputStream(String filename)
|
abstract void |
spiPrintLine(Writer writer,
String msg)
|
abstract String |
spiReadLine(Reader reader)
|
abstract void |
spiWaitKey()
|
static String |
toString(byte[] byteArray,
int off,
int len,
String delimiter)
Converts the specified subsequence of the given byte array into a hexadecimal string of the format: 01:23:34:56... |
static void |
waitKey()
Dummy Waikey function with no effect, because userinput depends on the device used. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SysUtil()
Method Detail |
public static void setSysUtil(String className) throws InstantiationException
classname
- - the fully qualified name of the desired class.InstantiationException
- if an instanciation exception occures (when the new class is not related to SysUtil or the class cannot be found)public static void setSysUtil(SysUtil sysUtilParam)
SysUtilObject
- a dynamicaly created SysUtil objectpublic static SysUtil getSysUtil()
public static boolean loadLibrary(String libraryName) throws Throwable
The library is normaly searched for in the operatingsystems system directory. Check your operatingsystems documentation for further details.
libraryname
- public static InputStream openFileInputStream(String filename) throws IOException
see the CLDC specification/documentation for further details.
For other protocols use openURLInputStream(String protocolAndFilename)
instead.
filename
- with path infopublic static OutputStream openFileOutputStream(String filename) throws IOException
see the CLDC specification/documentation for further details.
For other protocols use openURLOutputStream(String protocolAndFilename)
instead.
filename
- with path infopublic static InputStream openURLInputStream(String protocolAndFilename) throws IOException
InputStream in = openURLInputStream("file://demo.txt");
or
InputStream in = openURLInputStream("http://www.server.com:80");
URL
- to resourcepublic static OutputStream openURLOutputStream(String protocolAndFilename) throws IOException
OutputStream in = openURLOutputStream("file://demo.txt");
URL
- to resourcepublic static void nextBytes(Random random, byte[] data)
a
- random number generatora
- byte array to put the result intopublic static Reader getLineReader(Reader reader)
a
- Reader objectpublic static String readLine(Reader reader) throws IOException
a
- Reader object with an open stream.public static Writer getLineWriter(Writer writer)
a
- Reader objectpublic static void printLine(Writer writer)
a
- Writer object with an open stream.public static void printLine(Writer writer, String msg)
a
- Writer object with an open stream.public static void waitKey()
because userinput depends on the device used. There is only a text output.
public static String toString(byte[] byteArray, int off, int len, String delimiter)
Starting at off
, len
bytes will be converted and
returned as hexadecimal string, e.g.:
byte[] arr = ...; System.out.println(Util.toString(arr, 0, 3));
byteArray
- the byte array containing the dataoff
- the offset indicating the start position within the given byte array; the
following len
bytes will be converted into a hexadecimal stringlen
- how many bytes shall be writtendelimiter
- the delimiter to be used for separating the hex values, e.g. ":"
(specify "" for not using a delimiter)public abstract boolean spiLoadLibrary(String libraryName) throws Throwable
public abstract InputStream spiOpenFileInputStream(String filename) throws IOException
public abstract OutputStream spiOpenFileOutputStream(String filename) throws IOException
public abstract InputStream spiOpenURLInputStream(String filename) throws IOException
public abstract OutputStream spiOpenURLOutputStream(String filename) throws IOException
public abstract void spiNextBytes(Random random, byte[] data)
public abstract Reader spiGetLineReader(Reader reader)
public abstract String spiReadLine(Reader reader) throws IOException
public abstract Writer spiGetLineWriter(Writer writer)
public abstract void spiPrintLine(Writer writer, String msg)
public abstract void spiWaitKey()
|
This Javadoc may contain text parts from IETF Internet Standard specifications, see copyright note) and RSA Data Security Public-Key Cryptography Standards (see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |