本文整理汇总了Java中javax.jmdns.impl.DNSOutgoing.MessageOutputStream类的典型用法代码示例。如果您正苦于以下问题:Java MessageOutputStream类的具体用法?Java MessageOutputStream怎么用?Java MessageOutputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageOutputStream类属于javax.jmdns.impl.DNSOutgoing包,在下文中一共展示了MessageOutputStream类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import javax.jmdns.impl.DNSOutgoing.MessageOutputStream; //导入依赖的package包/类
@Override
void write(MessageOutputStream out) {
if (_addr != null) {
byte[] buffer = _addr.getAddress();
// If we have a type A records we should answer with a IPv4 address
if (_addr instanceof Inet4Address) {
// All is good
} else {
// Get the last four bytes
byte[] tempbuffer = buffer;
buffer = new byte[4];
System.arraycopy(tempbuffer, 12, buffer, 0, 4);
}
int length = buffer.length;
out.writeBytes(buffer, 0, length);
}
}
示例2: write
import javax.jmdns.impl.DNSOutgoing.MessageOutputStream; //导入依赖的package包/类
@Override
void write(MessageOutputStream out)
{
if (_addr != null)
{
byte[] buffer = _addr.getAddress();
// If we have a type A records we should answer with a IPv4 address
if (_addr instanceof Inet4Address)
{
// All is good
}
else
{
// Get the last four bytes
byte[] tempbuffer = buffer;
buffer = new byte[4];
System.arraycopy(tempbuffer, 12, buffer, 0, 4);
}
int length = buffer.length;
out.writeBytes(buffer, 0, length);
}
}