Methods Summary |
---|
protected native int | available0()
|
public synchronized void | close()Close the connection.
if (copen) {
copen = false;
realClose();
}
|
protected native void | close0()
|
void | ensureOpen()Ensure connection is open
if (!copen) {
throw new IOException("Connection closed");
}
|
private static native void | initializeInternal()Class initializer
|
public void | open(java.lang.String name, int mode, boolean timeouts)Open the connection /* Default is no buffering */
initializeInternal();
/* See if a read ahead / write behind buffer size has been specified */
String size = System.getProperty("com.sun.cldc.io.j2me.socket.buffersize");
if (size != null) {
try {
bufferSize = Integer.parseInt(size);
} catch(NumberFormatException ex) {}
}
throw new RuntimeException("Should not be called");
|
public void | open(int handle, int mode)Open the connection
this.handle = handle;
opens++;
copen = true;
this.mode = mode;
|
protected native void | open0(java.lang.String name, int mode, boolean timeouts)
|
public java.io.DataInputStream | openDataInputStream()Open and return a data input stream for a connection.
return new DataInputStream(openInputStream());
|
public java.io.DataOutputStream | openDataOutputStream()Open and return a data output stream for a connection.
return new DataOutputStream(openOutputStream());
|
public synchronized java.io.InputStream | openInputStream()Returns an input stream for this socket.
ensureOpen();
if ((mode&Connector.READ) == 0) {
throw new IOException("Connection not open for reading");
}
if (isopen) {
throw new IOException("Input stream already opened");
}
isopen = true;
InputStream in;
if (bufferSize == 0) {
in = new PrivateInputStream(this);
} else {
in = new PrivateInputStreamWithBuffer(this, bufferSize);
}
opens++;
return in;
|
public synchronized java.io.OutputStream | openOutputStream()Returns an output stream for this socket.
ensureOpen();
if ((mode&Connector.WRITE) == 0) {
throw new IOException("Connection not open for writing");
}
if (osopen) {
throw new IOException("Output stream already opened");
}
osopen = true;
OutputStream os;
os = new PrivateOutputStream(this);
opens++;
return os;
|
public Connection | openPrim(java.lang.String name, int mode, boolean timeouts)Open the connection
try {
open0(name, mode, timeouts);
registerCleanup();
opens++;
copen = true;
this.mode = mode;
return this;
} catch(InterruptedException x) {
// com.sun.cldc.io.j2me.serversocket.Protocol con;
// con = new com.sun.cldc.io.j2me.serversocket.Protocol();
// con.open(name, mode, timeouts);
// return con;
return null;
}
|
protected native int | read0(byte[] b, int off, int len)
|
synchronized void | realClose()Close the connection.
if (--opens == 0) {
close0();
}
|
private native void | registerCleanup()
|
protected native int | write0(byte[] b, int off, int len)
|