iaik.me.utils
Class SysUtilME

java.lang.Object
  |
  +--iaik.me.utils.SysUtil
        |
        +--iaik.me.utils.SysUtilME

public class SysUtilME
extends SysUtil


Method Summary
 Reader spiGetLineReader(Reader reader)
          Returns a an availibel LineReader.
 Writer spiGetLineWriter(Writer writer)
          In case of the J2SE it turns the Writer into a PrintWriter.
 boolean spiLoadLibrary(String libraryName)
          Loads a native code library.
 void spiNextBytes(Random random, byte[] data)
          Returns an array of random bytes, the CLDC spec. defines only functions for int- and long type arrays.
 InputStream spiOpenFileInputStream(String filename)
          Opens an InputStream to a given file.
 OutputStream spiOpenFileOutputStream(String filename)
          Opens an OutputStream to a given file.
 InputStream spiOpenURLInputStream(String protocolAndFilename)
          Opens an InputStream to a resource with a given URL.
 OutputStream spiOpenURLOutputStream(String protocolAndFilename)
          Opens an OutputStream to a resource with a given URL.
 void spiPrintLine(Writer writer, String msg)
          Writes a carriage return into the stream.
 String spiReadLine(Reader reader)
          Reads a line with a specified Reader.
 void spiWaitKey()
          Dummy Waikey function with no effect, because userinput depends on the device used.
 
Methods inherited from class iaik.me.utils.SysUtil
getLineReader, getLineWriter, getSysUtil, loadLibrary, nextBytes, openFileInputStream, openFileOutputStream, openURLInputStream, openURLOutputStream, printLine, printLine, readLine, setSysUtil, setSysUtil, toString, waitKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

spiOpenFileInputStream

public InputStream spiOpenFileInputStream(String filename)
                                   throws IOException
Opens an InputStream to a given file. The file must exist upon opening. This function uses the "file" protocol in the Connector class which may not be implemented on some platforms,

see the CLDC specification/documentation for further details.

For other protocols use openURLInputStream(String protocolAndFilename) instead.

Overrides:
spiOpenFileInputStream in class SysUtil
Parameters:
filename - with path info
Returns:
InputStream to the file
Throws:
IOException -  

spiOpenFileOutputStream

public OutputStream spiOpenFileOutputStream(String filename)
                                     throws IOException
Opens an OutputStream to a given file. The file will be created if it does not exist. This function uses the "file" protocol in the Connector class which may not be implemented on some platforms,

see the CLDC specification/documentation for further details.

For other protocols use spiOpenURLOutputStream(String protocolAndFilename) instead.

Overrides:
spiOpenFileOutputStream in class SysUtil
Parameters:
filename - with path info
Returns:
OutputStream to the file
Throws:
IOException -  

spiOpenURLInputStream

public InputStream spiOpenURLInputStream(String protocolAndFilename)
                                  throws IOException
Opens an InputStream to a resource with a given URL. The resource must already exist upon opening. See J2ME documentation and RFC 2396 for more information about how a URL is defined. For example:

InputStream in = spiOpenURLInputStream("file:demo.txt");

or

InputStream in = spiOpenURLInputStream("http://www.server.com:80");

Overrides:
spiOpenURLInputStream in class SysUtil
Parameters:
URL - to resource
Returns:
InputStream to the resource
Throws:
IOException -  

spiOpenURLOutputStream

public OutputStream spiOpenURLOutputStream(String protocolAndFilename)
                                    throws IOException
Opens an OutputStream to a resource with a given URL. See J2ME documentation and RFC 2396 for more information about how a URL is defined. For example:

OutputStream in = spiOpenURLOutputStream("file:demo.txt");

Overrides:
spiOpenURLOutputStream in class SysUtil
Parameters:
URL - to resource
Returns:
OutputStream to the resource
Throws:
IOException -  

spiNextBytes

public void spiNextBytes(Random random,
                         byte[] data)
Returns an array of random bytes, the CLDC spec. defines only functions for int- and long type arrays.
Overrides:
spiNextBytes in class SysUtil
Parameters:
a - random number generator
a - byte array to put the result into

spiLoadLibrary

public boolean spiLoadLibrary(String libraryName)
                       throws Throwable
Loads a native code library.

The library is normaly searched for in the operatingsystems system directory. Check your operatingsystems documentation for further details. This function alway return false in the CLDC version of this library.

Overrides:
spiLoadLibrary in class SysUtil
Parameters:
libraryname -  
Returns:
true if library was succesfully loaded, false if not
Throws:
Throwable -  

spiGetLineReader

public Reader spiGetLineReader(Reader reader)
Returns a an availibel LineReader. On J2SE it casts the Reader into a BufferedReader. On J2ME,

where the BufferedReader is not available, it returns the Reader unchanged. In case of the J2SE it returns a Buffered Reader

Overrides:
spiGetLineReader in class SysUtil
Parameters:
Reader -  
Returns:
an available LineReader

spiReadLine

public String spiReadLine(Reader reader)
                   throws IOException
Reads a line with a specified Reader. The line can be terminated by \r\n or \n.
Overrides:
spiReadLine in class SysUtil
Parameters:
a - specified reader
Returns:
the read line
Throws:
IOException -  

spiGetLineWriter

public Writer spiGetLineWriter(Writer writer)
In case of the J2SE it turns the Writer into a PrintWriter. On then J2ME it does nothing with the Writer object, just return it.
Overrides:
spiGetLineWriter in class SysUtil
Parameters:
a - Reader object
Returns:
PrintWriter or Writer object

spiPrintLine

public void spiPrintLine(Writer writer,
                         String msg)
Writes a carriage return into the stream. On J2SE it uses the PrintWriter on J2ME the standard Reader to write the string.
Overrides:
spiPrintLine in class SysUtil
Parameters:
a - Writer object with an open stream.

spiWaitKey

public void spiWaitKey()
Dummy Waikey function with no effect,

because userinput depends on the device used. There is only a text output.

Overrides:
spiWaitKey in class SysUtil

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).

IAIK-JCE ME 3.04, (c) 2002 IAIK, (c) 2003 to 2006 Stiftung SIC