GigaSpaces XAP 9.7.2 API

com.sun.jini.discovery.internal
Class Plaintext

java.lang.Object
  extended by com.sun.jini.discovery.internal.Plaintext

public class Plaintext
extends Object

Provides utility methods for plaintext data operations.


Method Summary
static void checkConstraints(InvocationConstraints constraints)
          Returns normally if the given constraints can be satisfied by a plaintext-based format/protocol (such as net.jini.discovery.plaintext, or version 1 of the discovery protocols); otherwise, throws an UnsupportedConstraintException .
static MulticastAnnouncement decodeMulticastAnnouncement(ByteBuffer buf)
          Decodes multicast announcement according to the net.jini.discovery.plaintext format.
static MulticastRequest decodeMulticastRequest(ByteBuffer buf)
          Decodes multicast request according to the net.jini.discovery.plaintext format.
static void encodeMulticastAnnouncement(MulticastAnnouncement announcement, DatagramBufferFactory bufs)
          Encodes multicast announcement according to the net.jini.discovery.plaintext format.
static void encodeMulticastRequest(MulticastRequest request, DatagramBufferFactory bufs)
          Encodes multicast request according to the net.jini.discovery.plaintext format.
static String getUtf(ByteBuffer buf)
          Returns string read from the given buffer in UTF format , starting at the buffer's current position and not exceeding its limit.
static short intToUshort(int i)
          Returns the given integer value as an unsigned short, throwing an IllegalArgumentException if the value is negative or too large.
static void putUtf(ByteBuffer buf, String s)
          Writes the given string to the provided buffer in UTF format, starting at the buffer's current position and not exceeding its limit.
static UnicastResponse readUnicastResponse(InputStream in, ClassLoader defaultLoader, boolean verifyCodebaseIntegrity, ClassLoader verifierLoader, Collection context)
          Reads unicast response according to the net.jini.discovery.plaintext format.
static byte[] toUtf(String s)
          Returns a byte array containing the UTF encoding of the given string.
static int ushortToInt(short s)
          Returns an integer with the unsigned value of the given short.
static void writeUnicastResponse(OutputStream out, UnicastResponse response, Collection context)
          Writes unicast response according to the net.jini.discovery.plaintext format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

intToUshort

public static short intToUshort(int i)
Returns the given integer value as an unsigned short, throwing an IllegalArgumentException if the value is negative or too large.


ushortToInt

public static int ushortToInt(short s)
Returns an integer with the unsigned value of the given short.


toUtf

public static byte[] toUtf(String s)
                    throws UTFDataFormatException
Returns a byte array containing the UTF encoding of the given string.

Throws:
UTFDataFormatException

putUtf

public static void putUtf(ByteBuffer buf,
                          String s)
                   throws UTFDataFormatException
Writes the given string to the provided buffer in UTF format, starting at the buffer's current position and not exceeding its limit. If the encoding of the given string exceeds the buffer's limit, then a BufferOverflowException is thrown and the position of the buffer is left unchanged from its initial value.

Throws:
UTFDataFormatException

getUtf

public static String getUtf(ByteBuffer buf)
                     throws UTFDataFormatException
Returns string read from the given buffer in UTF format , starting at the buffer's current position and not exceeding its limit. If the string's encoding extends past the buffer's limit, then a BufferUnderflowException is thrown and the position of the buffer is left unchanged from its initial value.

Throws:
UTFDataFormatException

checkConstraints

public static void checkConstraints(InvocationConstraints constraints)
                             throws UnsupportedConstraintException
Returns normally if the given constraints can be satisfied by a plaintext-based format/protocol (such as net.jini.discovery.plaintext, or version 1 of the discovery protocols); otherwise, throws an UnsupportedConstraintException . Null constraints are considered equivalent to empty constraints.

Throws:
UnsupportedConstraintException

encodeMulticastRequest

public static void encodeMulticastRequest(MulticastRequest request,
                                          DatagramBufferFactory bufs)
                                   throws IOException
Encodes multicast request according to the net.jini.discovery.plaintext format.

Throws:
IOException

decodeMulticastRequest

public static MulticastRequest decodeMulticastRequest(ByteBuffer buf)
                                               throws IOException
Decodes multicast request according to the net.jini.discovery.plaintext format.

Throws:
IOException

encodeMulticastAnnouncement

public static void encodeMulticastAnnouncement(MulticastAnnouncement announcement,
                                               DatagramBufferFactory bufs)
                                        throws IOException
Encodes multicast announcement according to the net.jini.discovery.plaintext format.

Throws:
IOException

decodeMulticastAnnouncement

public static MulticastAnnouncement decodeMulticastAnnouncement(ByteBuffer buf)
                                                         throws IOException
Decodes multicast announcement according to the net.jini.discovery.plaintext format.

Throws:
IOException

writeUnicastResponse

public static void writeUnicastResponse(OutputStream out,
                                        UnicastResponse response,
                                        Collection context)
                                 throws IOException
Writes unicast response according to the net.jini.discovery.plaintext format.

Throws:
IOException

readUnicastResponse

public static UnicastResponse readUnicastResponse(InputStream in,
                                                  ClassLoader defaultLoader,
                                                  boolean verifyCodebaseIntegrity,
                                                  ClassLoader verifierLoader,
                                                  Collection context)
                                           throws IOException,
                                                  ClassNotFoundException
Reads unicast response according to the net.jini.discovery.plaintext format.

Throws:
IOException
ClassNotFoundException

GigaSpaces XAP 9.7.2 API

Copyright © GigaSpaces.