com.hazelcast.nio
Class IOUtil

java.lang.Object
  extended by com.hazelcast.nio.IOUtil

public final class IOUtil
extends Object


Field Summary
static byte PRIMITIVE_TYPE_BOOLEAN
           
static byte PRIMITIVE_TYPE_BYTE
           
static byte PRIMITIVE_TYPE_DOUBLE
           
static byte PRIMITIVE_TYPE_FLOAT
           
static byte PRIMITIVE_TYPE_INTEGER
           
static byte PRIMITIVE_TYPE_LONG
           
static byte PRIMITIVE_TYPE_SHORT
           
static byte PRIMITIVE_TYPE_UTF
           
 
Method Summary
static void closeResource(Closeable closeable)
          Closes the Closable quietly.
static byte[] compress(byte[] input)
           
static int copyToDirectBuffer(ByteBuffer src, ByteBuffer dest)
           
static int copyToHeapBuffer(ByteBuffer src, ByteBuffer dest)
           
static byte[] decompress(byte[] compressedData)
           
static long extractOperationCallId(Data data, SerializationService serializationService)
          This method has a direct dependency on how objects are serialized in DataSerializer! If the stream format is ever changed this extraction method needs to be changed too!
static InputStream newInputStream(ByteBuffer buf)
           
static ObjectInputStream newObjectInputStream(ClassLoader classLoader, InputStream in)
           
static OutputStream newOutputStream(ByteBuffer buf)
           
static Object readAttributeValue(ObjectDataInput in)
           
static byte[] readByteArray(ObjectDataInput in)
           
static String readLongString(DataInput in)
           
static
<T> T
readObject(ObjectDataInput in)
           
static void writeAttributeValue(Object value, ObjectDataOutput out)
           
static void writeByteArray(ObjectDataOutput out, byte[] value)
           
static void writeLongString(DataOutput dos, String str)
           
static void writeObject(ObjectDataOutput out, Object object)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIMITIVE_TYPE_BOOLEAN

public static final byte PRIMITIVE_TYPE_BOOLEAN
See Also:
Constant Field Values

PRIMITIVE_TYPE_BYTE

public static final byte PRIMITIVE_TYPE_BYTE
See Also:
Constant Field Values

PRIMITIVE_TYPE_SHORT

public static final byte PRIMITIVE_TYPE_SHORT
See Also:
Constant Field Values

PRIMITIVE_TYPE_INTEGER

public static final byte PRIMITIVE_TYPE_INTEGER
See Also:
Constant Field Values

PRIMITIVE_TYPE_LONG

public static final byte PRIMITIVE_TYPE_LONG
See Also:
Constant Field Values

PRIMITIVE_TYPE_FLOAT

public static final byte PRIMITIVE_TYPE_FLOAT
See Also:
Constant Field Values

PRIMITIVE_TYPE_DOUBLE

public static final byte PRIMITIVE_TYPE_DOUBLE
See Also:
Constant Field Values

PRIMITIVE_TYPE_UTF

public static final byte PRIMITIVE_TYPE_UTF
See Also:
Constant Field Values
Method Detail

extractOperationCallId

public static long extractOperationCallId(Data data,
                                          SerializationService serializationService)
                                   throws IOException
This method has a direct dependency on how objects are serialized in DataSerializer! If the stream format is ever changed this extraction method needs to be changed too!

Throws:
IOException

writeByteArray

public static void writeByteArray(ObjectDataOutput out,
                                  byte[] value)
                           throws IOException
Throws:
IOException

readByteArray

public static byte[] readByteArray(ObjectDataInput in)
                            throws IOException
Throws:
IOException

writeObject

public static void writeObject(ObjectDataOutput out,
                               Object object)
                        throws IOException
Throws:
IOException

readObject

public static <T> T readObject(ObjectDataInput in)
                    throws IOException
Throws:
IOException

newObjectInputStream

public static ObjectInputStream newObjectInputStream(ClassLoader classLoader,
                                                     InputStream in)
                                              throws IOException
Throws:
IOException

newOutputStream

public static OutputStream newOutputStream(ByteBuffer buf)

newInputStream

public static InputStream newInputStream(ByteBuffer buf)

copyToHeapBuffer

public static int copyToHeapBuffer(ByteBuffer src,
                                   ByteBuffer dest)

copyToDirectBuffer

public static int copyToDirectBuffer(ByteBuffer src,
                                     ByteBuffer dest)

writeLongString

public static void writeLongString(DataOutput dos,
                                   String str)
                            throws IOException
Throws:
IOException

readLongString

public static String readLongString(DataInput in)
                             throws IOException
Throws:
IOException

compress

public static byte[] compress(byte[] input)
                       throws IOException
Throws:
IOException

decompress

public static byte[] decompress(byte[] compressedData)
                         throws IOException
Throws:
IOException

writeAttributeValue

public static void writeAttributeValue(Object value,
                                       ObjectDataOutput out)
                                throws IOException
Throws:
IOException

readAttributeValue

public static Object readAttributeValue(ObjectDataInput in)
                                 throws IOException
Throws:
IOException

closeResource

public static void closeResource(Closeable closeable)
Closes the Closable quietly. So no exception will be thrown. Can also safely be called with a null value.

Parameters:
closeable - the Closeable to close.


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.