Example usage for java.net Inet6Address getAddress

List of usage examples for java.net Inet6Address getAddress

Introduction

In this page you can find the example usage for java.net Inet6Address getAddress.

Prototype

@Override
public byte[] getAddress() 

Source Link

Document

Returns the raw IP address of this InetAddress object.

Usage

From source file:net.fenyo.gnetwatch.GenericTools.java

/**
 * Converts an IP address to its string representation.
 * @param addr ipv6 address.//from w  ww . j  a  v a2 s  . c  o  m
 * @return String ascii representation.
 */
static public String inet6AddressToString(final Inet6Address addr) {
    try {
        byte bytes[] = addr.getAddress();
        return InetAddress.getByAddress(bytes).toString().substring(1);
    } catch (final UnknownHostException ex) {
        log.error("Exception", ex);
    }
    return "";
}

From source file:org.calrissian.mango.types.encoders.lexi.Inet6AddressEncoder.java

@Override
public String encode(Inet6Address value) {
    checkNotNull(value, "Null values are not allowed");
    return encodeHexString(value.getAddress());
}

From source file:org.calrissian.mango.types.encoders.lexi.Inet6AddressReverseEncoder.java

@Override
public String encode(Inet6Address value) {
    checkNotNull(value, "Null values are not allowed");
    return encodeHexString(reverse(value.getAddress()));
}

From source file:org.pircbotx.dcc.DCCTest.java

@Test
public void incommingDccChatTest() throws IOException, InterruptedException, IrcException {
    Inet6Address localhost6 = (Inet6Address) InetAddress.getByName("::1");

    //Create listener to handle everything
    final MutableObject<IncomingChatRequestEvent> mutableEvent = new MutableObject<IncomingChatRequestEvent>();
    bot.getConfiguration().getListenerManager().addListener(new ListenerAdapter() {
        @Override//from   w w w  . j av a 2s.  c om
        public void onIncomingChatRequest(IncomingChatRequestEvent event) throws Exception {
            mutableEvent.setValue(event);
        }
    });

    System.out.println("localhost6 byte array: " + Arrays.toString(localhost6.getAddress()));
    System.out.println("localhost6 int: " + new BigInteger(localhost6.getAddress()));

    bot.getInputParser().handleLine(":ANick!~ALogin@::2 PRIVMSG Quackbot5 :DCC CHAT chat 1 35589");
    IncomingChatRequestEvent event = mutableEvent.getValue();
    assertNotNull(event, "No IncomingChatRequestEvent dispatched");

    System.out.println("Test ran");
}