public class RawSocket extends Object implements ByteChannel, GatheringByteChannel
| Constructor and Description |
|---|
RawSocket() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
byte[] |
getHardwareAddress() |
static String[] |
getInterfaceNames()
This method calls native code to get all interface names.
|
boolean |
isOpen() |
static void |
nativeClose(int sd) |
static int |
nativeGetHardwareAddress(int sd,
ByteBuffer bb) |
static String[] |
nativeGetInterfaceNames() |
static void |
nativeInit() |
static int |
nativeOpen(String ifName) |
static int |
nativeRead(int sd,
ByteBuffer bb,
int offset,
int length) |
static int |
nativeWrite(int sd,
ByteBuffer bb,
int offset,
int length) |
void |
open(String ifName) |
int |
read(ByteBuffer bb) |
long |
read(ByteBuffer[] bbs,
int offset,
int length) |
String |
toString() |
int |
write(ByteBuffer bb) |
long |
write(ByteBuffer[] bbs) |
long |
write(ByteBuffer[] bbs,
int offset,
int length) |
public RawSocket()
throws IOException
IOExceptionpublic static void nativeInit()
public static int nativeOpen(String ifName)
public static void nativeClose(int sd)
public static int nativeRead(int sd,
ByteBuffer bb,
int offset,
int length)
public static int nativeWrite(int sd,
ByteBuffer bb,
int offset,
int length)
public static String[] nativeGetInterfaceNames()
public static int nativeGetHardwareAddress(int sd,
ByteBuffer bb)
public void open(String ifName) throws IOException
IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface ChannelIOExceptionpublic int read(ByteBuffer bb) throws IOException
read in interface ReadableByteChannelIOExceptionpublic long read(ByteBuffer[] bbs, int offset, int length) throws IOException
IOExceptionpublic int write(ByteBuffer bb) throws IOException
write in interface WritableByteChannelIOExceptionpublic long write(ByteBuffer[] bbs) throws IOException
write in interface GatheringByteChannelIOExceptionpublic long write(ByteBuffer[] bbs, int offset, int length) throws IOException
write in interface GatheringByteChannelIOExceptionpublic byte[] getHardwareAddress()
public static String[] getInterfaceNames()
Copyright © 2014. All rights reserved.