|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectutil.NetUtil
Diese Klasse fasst einige Netzwerk-Utilities zusammen
Field Summary | |
static boolean |
DEBUG
|
Method Summary | |
static byte[] |
readByteArray(java.net.Socket socket,
int maxLänge)
Liest aus dem InputStream des Socket die nächsten 4 Bytes, baut daraus eine Integerzahl, interpretiert diesen Wert als Länge und liest entsprechend viele Zeichen aus. |
static void |
sendError(java.net.Socket socket,
int messageType,
int errorcode)
Sendet eine Fehlermeldung ins Netz. |
static void |
sendPaket(java.net.Socket socket,
byte[] paket)
|
static byte[] |
toByteArray(int l)
Wandelt die übergebene int-Zahl in ein Byte-Array um |
static int |
toInt(java.io.InputStream byteStream)
Liest 4 Zeichen aus dem Stream aus und interpretiert diese als int-Zahl |
static void |
writeArray(java.net.Socket socket,
byte[] array)
Schreibt das übergebene Array auf den OutputStream des Sockets, mit der Längenangabe davor |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final boolean DEBUG
Method Detail |
public static byte[] readByteArray(java.net.Socket socket, int maxLänge) throws ConnectionResetException, java.io.IOException
socket
- maxLänge
- maximal erlaubte Länge des Arrays (um OutOfMemoryErrors zu verhindern)
ArrayZuLangException
- wird geworfen, wenn das zu lesende Array länger ist als erlaubt
ConnectionResetException
- wenn der Stream zu Ende ist
java.io.IOException
writeArray(Socket, byte[])
public static byte[] toByteArray(int l)
public static int toInt(java.io.InputStream byteStream) throws ConnectionResetException, java.io.IOException
ConnectionResetException
java.io.IOException
public static void writeArray(java.net.Socket socket, byte[] array) throws java.io.IOException
java.io.IOException
toByteArray(int)
public static void sendError(java.net.Socket socket, int messageType, int errorcode) throws KerberosRuntimeException
socket
- messageType
- errorcode
-
KerberosRuntimeException
- Wird geworfen, wenn eine PacketException aufgetreten istMessageBuilder.buildError(int, int)
,
PacketException
public static void sendPaket(java.net.Socket socket, byte[] paket) throws java.io.IOException
java.io.IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |