com.sun.squawk.io.j2me.memory
Class Protocol
java.lang.Object
com.sun.squawk.io.ConnectionBase
com.sun.squawk.io.j2me.memory.Protocol
- All Implemented Interfaces:
- Connection, InputConnection, OutputConnection, StreamConnection
public class Protocol
- extends ConnectionBase
- implements StreamConnection
This class allows access to the raw memory of the host device from the GCF
framework. The access provided is read-only, and so attempts to open output
streams will generate IllegalStateExceptions. If you want to
write to flash memory, see IFlashMemoryDevice
You should normally access this class indirectly via the GCF framework. For example:
...
int memAddress= 0x10000;
StreamConnection conn = (StreamConnection) Connector.open("memory://" + memAddress);
MemoryInputStream mis = (MemoryInputStream)conn.openInputStream();
...
- See Also:
MemoryInputStream
Protocol
public Protocol()
open
public Connection open(String protocolName,
String name,
int mode,
boolean timeouts)
- Description copied from class:
ConnectionBase
- Open a connection to a target.
- Specified by:
open
in class ConnectionBase
- Parameters:
protocolName
- The URL protocolname
- The URL for the connectionmode
- The access modetimeouts
- A flag to indicate that the caller
wants timeout exceptions
- Returns:
- A new Connection object
openInputStream
public InputStream openInputStream()
- Open and return an input stream for a connection.
- Specified by:
openInputStream
in interface InputConnection
- Overrides:
openInputStream
in class ConnectionBase
- Returns:
- An input stream
openOutputStream
public OutputStream openOutputStream()
- Throws IllegalStateException (output not supported for memory streams). If you want to
write to flash memory, see
IFlashMemoryDevice
- Specified by:
openOutputStream
in interface OutputConnection
- Overrides:
openOutputStream
in class ConnectionBase
- Returns:
- An output stream
Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.