|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openflow.gui.net.SocketConnection
public class SocketConnection
Provides helper functions for setting up and sending and receiving binary and ASCII data over a TCP connection.
| Field Summary | |
|---|---|
CountingDataInputStream |
in
input stream to read from the socket |
java.io.DataOutputStream |
out
output stream to write to the socket |
java.net.Socket |
s
the socket which connects us to the NOX server |
| Constructor Summary | |
|---|---|
SocketConnection(java.lang.String ip,
int port)
Connect to the client on the specified port. |
|
| Method Summary | |
|---|---|
long |
getBytesRead()
|
boolean |
readBoolean()
|
byte |
readByte()
|
char |
readChar()
|
double |
readDouble()
|
float |
readFloat()
|
void |
readFully(byte[] b)
|
void |
readFully(byte[] b,
int off,
int len)
|
int |
readInt()
|
java.lang.String |
readLine()
|
long |
readLong()
|
java.lang.String |
readNullTerminatedString()
Reads to form a string. |
static java.lang.String |
readNullTerminatedString(java.io.DataInput in)
Reads from in to form a string. |
short |
readShort()
|
static java.lang.String |
readString(java.io.DataInput in,
int bytesToRead)
Reads the specified number of bytes from in to form a string. |
java.lang.String |
readString(int bytesToRead)
Reads the specified number of bytes to form a string. |
int |
readUnsignedByte()
|
int |
readUnsignedShort()
|
java.lang.String |
readUTF()
|
int |
skipBytes(int n)
|
void |
write(byte[] b)
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
void |
writeBoolean(boolean v)
|
void |
writeByte(int v)
|
void |
writeBytes(java.lang.String s)
|
void |
writeChar(int v)
|
void |
writeChars(java.lang.String s)
|
void |
writeDouble(double v)
|
void |
writeFloat(float v)
|
void |
writeInt(int v)
|
void |
writeLong(long v)
|
void |
writeShort(int v)
|
void |
writeUTF(java.lang.String s)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final java.net.Socket s
public final java.io.DataOutputStream out
public final CountingDataInputStream in
| Constructor Detail |
|---|
public SocketConnection(java.lang.String ip,
int port)
ip - the IP to connect toport - the TCP port to connect on| Method Detail |
|---|
public static java.lang.String readString(java.io.DataInput in,
int bytesToRead)
throws java.io.IOException
in - buffer to read frombytesToRead - number of bytes to read
java.io.IOException
public java.lang.String readString(int bytesToRead)
throws java.io.IOException
bytesToRead - number of bytes to read
java.io.IOException
public static java.lang.String readNullTerminatedString(java.io.DataInput in)
throws java.io.IOException
in - buffer to read from
java.io.IOException
public java.lang.String readNullTerminatedString()
throws java.io.IOException
java.io.IOExceptionpublic long getBytesRead()
public void readFully(byte[] b)
throws java.io.IOException
readFully in interface java.io.DataInputjava.io.IOException
public void readFully(byte[] b,
int off,
int len)
throws java.io.IOException
readFully in interface java.io.DataInputjava.io.IOException
public int skipBytes(int n)
throws java.io.IOException
skipBytes in interface java.io.DataInputjava.io.IOException
public boolean readBoolean()
throws java.io.IOException
readBoolean in interface java.io.DataInputjava.io.IOException
public byte readByte()
throws java.io.IOException
readByte in interface java.io.DataInputjava.io.IOException
public int readUnsignedByte()
throws java.io.IOException
readUnsignedByte in interface java.io.DataInputjava.io.IOException
public short readShort()
throws java.io.IOException
readShort in interface java.io.DataInputjava.io.IOException
public int readUnsignedShort()
throws java.io.IOException
readUnsignedShort in interface java.io.DataInputjava.io.IOException
public char readChar()
throws java.io.IOException
readChar in interface java.io.DataInputjava.io.IOException
public int readInt()
throws java.io.IOException
readInt in interface java.io.DataInputjava.io.IOException
public long readLong()
throws java.io.IOException
readLong in interface java.io.DataInputjava.io.IOException
public float readFloat()
throws java.io.IOException
readFloat in interface java.io.DataInputjava.io.IOException
public double readDouble()
throws java.io.IOException
readDouble in interface java.io.DataInputjava.io.IOException
public java.lang.String readLine()
throws java.io.IOException
readLine in interface java.io.DataInputjava.io.IOException
public java.lang.String readUTF()
throws java.io.IOException
readUTF in interface java.io.DataInputjava.io.IOException
public void write(int b)
throws java.io.IOException
write in interface java.io.DataOutputjava.io.IOException
public void write(byte[] b)
throws java.io.IOException
write in interface java.io.DataOutputjava.io.IOException
public void write(byte[] b,
int off,
int len)
throws java.io.IOException
write in interface java.io.DataOutputjava.io.IOException
public void writeBoolean(boolean v)
throws java.io.IOException
writeBoolean in interface java.io.DataOutputjava.io.IOException
public void writeByte(int v)
throws java.io.IOException
writeByte in interface java.io.DataOutputjava.io.IOException
public void writeShort(int v)
throws java.io.IOException
writeShort in interface java.io.DataOutputjava.io.IOException
public void writeChar(int v)
throws java.io.IOException
writeChar in interface java.io.DataOutputjava.io.IOException
public void writeInt(int v)
throws java.io.IOException
writeInt in interface java.io.DataOutputjava.io.IOException
public void writeLong(long v)
throws java.io.IOException
writeLong in interface java.io.DataOutputjava.io.IOException
public void writeFloat(float v)
throws java.io.IOException
writeFloat in interface java.io.DataOutputjava.io.IOException
public void writeDouble(double v)
throws java.io.IOException
writeDouble in interface java.io.DataOutputjava.io.IOException
public void writeBytes(java.lang.String s)
throws java.io.IOException
writeBytes in interface java.io.DataOutputjava.io.IOException
public void writeChars(java.lang.String s)
throws java.io.IOException
writeChars in interface java.io.DataOutputjava.io.IOException
public void writeUTF(java.lang.String s)
throws java.io.IOException
writeUTF in interface java.io.DataOutputjava.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||