public class IOUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
IOUtils.NoHeaderObjectInputStream |
static class |
IOUtils.NoHeaderObjectOutputStream |
| Modifier and Type | Field and Description |
|---|---|
static boolean |
SMART_EXTERNALIZABLE_ENABLED |
| Constructor and Description |
|---|
IOUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Object |
deepClone(Object obj)
A deep copy makes a distinct copy of each of the object's fields, recursing through the
entire graph of other objects referenced by the object being copied.
|
static void |
deserializeSupportCodeChangeCollection(ObjectInput in,
Collection collection)
|
static int |
getAnonymousPort()
Get an anonymous socket port.
|
static Map<Class<?>,IClassSerializer<?>> |
getClassSerializers() |
static IClassSerializer<?> |
getDefaultSerializer() |
static boolean |
isArchive(String fileName) |
static boolean |
isPortBusy(int port,
String bindAddr)
Checks whether a supplied socket port is busy.
|
static Object |
objectFromByteBuffer(byte[] buffer)
Creates an object from a byte buffer.
|
static byte[] |
objectToByteBuffer(Object obj)
Serializes an object into a byte buffer.
|
static boolean[] |
readBooleanArray(ObjectInput in) |
static byte[] |
readByteArray(ObjectInput in) |
static void |
readCodeMaps(ObjectInput in) |
static IEntryPacket[] |
readEntryPacketArray(ObjectInput in) |
static Exception[] |
readExceptionArray(ObjectInput in) |
static int |
readInt(ObjectInput in) |
static int[] |
readIntegerArray(ObjectInput in) |
static List |
readList(ObjectInput in) |
static List<String> |
readListString(ObjectInput in) |
static long |
readLong(ObjectInput in) |
static long[] |
readLongArray(ObjectInput in) |
static <T> Map<String,T> |
readMapRepetitiveKeys(ObjectInput in) |
static Map<String,List<String>> |
readMapStringListString(ObjectInput in) |
static Map<String,Object> |
readMapStringObject(ObjectInput in) |
static Map<String,String> |
readMapStringString(ObjectInput in) |
static <T> Map<String,T> |
readMapStringT(ObjectInput in) |
static <T extends ISwapExternalizable> |
readNullableSwapExternalizableObject(ObjectInput in) |
static <T> T |
readObject(ObjectInput in) |
static Object |
readObject(ObjectInput in,
SupportCodeChangeAnnotationContainer supportCodeChangeAnnotationContainer,
boolean useIOUtilsReadObject)
Tasks are loaded with a fresh class loader.
|
static Object[] |
readObjectArray(ObjectInput in) |
static Object[] |
readObjectArrayCompressed(ObjectInput in) |
static <T> T |
readRepetitiveObject(ObjectInput in)
Objects read and written with repetitive must be immutable (cannot be changed as they are
kept in underlying map, changing them will affect the next repetitiveRead/Write
|
static String |
readRepetitiveString(ObjectInput in)
Read strings that were Shrinked using
writeRepetitiveString(ObjectOutput, String) |
static String[] |
readRepetitiveStringArray(ObjectInput in) |
static short |
readShort(ObjectInput in) |
static short[] |
readShortArray(ObjectInput in) |
static String |
readString(ObjectInput in) |
static String[] |
readStringArray(ObjectInput in) |
static Set<String> |
readStringSet(ObjectInput in) |
static <T extends ISwapExternalizable> |
readSwapExternalizableObject(ObjectInput in) |
static ITemplatePacket[] |
readTemplatePacketArray(ObjectInput in) |
static Throwable[] |
readThrowableArray(ObjectInput in) |
static UUID |
readUUID(ObjectInput in) |
static <T> T |
readWithCachedStubs(ObjectInput in) |
static void |
serializeSupportCodeChangeCollection(ObjectOutput out,
Collection collection)
Complement of
#deserializeSupportCodeChangeCollection(ObjectInput in, Collection collection)) |
static boolean |
targetSupportsSmartExternalizable() |
static void |
writeBooleanArray(ObjectOutput out,
boolean[] array) |
static void |
writeByteArray(ObjectOutput out,
byte[] array) |
static void |
writeCodeMaps(ObjectOutput out) |
static void |
writeInt(ObjectOutput out,
int value) |
static void |
writeIntegerArray(ObjectOutput out,
int[] array) |
static void |
writeList(ObjectOutput out,
List list) |
static void |
writeListString(ObjectOutput out,
List<String> list) |
static void |
writeLong(ObjectOutput out,
long value) |
static void |
writeLongArray(ObjectOutput out,
long[] array) |
static <T> void |
writeMapRepetitiveKeys(ObjectOutput out,
Map<String,T> map) |
static void |
writeMapStringListString(ObjectOutput out,
Map<String,List<String>> map) |
static void |
writeMapStringObject(ObjectOutput out,
Map<String,Object> map) |
static void |
writeMapStringString(ObjectOutput out,
Map<String,String> map) |
static <T> void |
writeMapStringT(ObjectOutput out,
Map<String,T> map) |
static void |
writeNullableSwapExternalizableObject(ObjectOutput out,
ISwapExternalizable swapExternalizable) |
static void |
writeObject(ObjectOutput out,
Object obj) |
static void |
writeObjectArray(ObjectOutput out,
Object[] array) |
static void |
writeObjectArrayCompressed(ObjectOutput out,
Object[] array) |
static void |
writeRepetitiveObject(ObjectOutput out,
Object obj)
Should only be used for objects that their class is known to SystemJars.DATA_GRID_JAR,
meaning at SystemJars.DATA_GRID_JAR, its dependencies or JDK Objects read and written with
repetitive must be immutable (cannot be changed as they are kept in underlying map, changing
them will affect the next repetitiveRead/Write
|
static void |
writeRepetitiveString(ObjectOutput out,
String s)
Shrink string over the wire, should be used for constant number of strings which are
repetitive (i.e space names, class names)
|
static void |
writeRepetitiveStringArray(ObjectOutput out,
String[] array) |
static void |
writeShort(ObjectOutput out,
short value) |
static void |
writeShortArray(ObjectOutput out,
short[] array) |
static void |
writeString(ObjectOutput out,
String s) |
static void |
writeStringArray(ObjectOutput out,
String[] array) |
static void |
writeStringSet(ObjectOutput out,
Set<String> set) |
static void |
writeSwapExternalizableObject(ObjectOutput out,
ISwapExternalizable swapExternalizable) |
static void |
writeUUID(ObjectOutput out,
UUID value) |
static void |
writeWithCachedStubs(ObjectOutput out,
Object obj) |
public static boolean isArchive(String fileName)
public static Object objectFromByteBuffer(byte[] buffer) throws Exception
Exceptionpublic static byte[] objectToByteBuffer(Object obj) throws Exception
Exceptionpublic static Object deepClone(Object obj)
obj - the object to clone, the object and object context must implement
java.io.Serializable.IllegalArgumentException - Failed to perform deep clone. The object of the context
object is not implements java.io.Serializable.public static void writeUUID(ObjectOutput out, UUID value) throws IOException
IOExceptionpublic static UUID readUUID(ObjectInput in) throws IOException
IOExceptionpublic static void writeCodeMaps(ObjectOutput out) throws IOException
IOExceptionpublic static void readCodeMaps(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static boolean isPortBusy(int port,
String bindAddr)
throws UnknownHostException
port - the port to check.bindAddr - check if port busy on specific InetAddress, If bindAddr is
null, it will default accepting connections on any/all local addressestrue if supplied port is busy, otherwise false.UnknownHostException - if no IP address for the host could be found, or if
a scope_id was specified for a global IPv6 address.public static int getAnonymousPort()
throws IOException
java.net.ServerSocket with
a port of 0IOExceptionpublic static void writeShortArray(ObjectOutput out, short[] array) throws IOException
IOExceptionpublic static short[] readShortArray(ObjectInput in) throws IOException
IOExceptionpublic static void writeIntegerArray(ObjectOutput out, int[] array) throws IOException
IOExceptionpublic static int[] readIntegerArray(ObjectInput in) throws IOException
IOExceptionpublic static void writeLongArray(ObjectOutput out, long[] array) throws IOException
IOExceptionpublic static long[] readLongArray(ObjectInput in) throws IOException
IOExceptionpublic static void writeByteArray(ObjectOutput out, byte[] array) throws IOException
IOExceptionpublic static byte[] readByteArray(ObjectInput in) throws IOException
IOExceptionpublic static void writeBooleanArray(ObjectOutput out, boolean[] array) throws IOException
IOExceptionpublic static boolean[] readBooleanArray(ObjectInput in) throws IOException
IOExceptionpublic static void writeRepetitiveString(ObjectOutput out, String s) throws IOException
IOExceptionpublic static String readRepetitiveString(ObjectInput in) throws IOException, ClassNotFoundException
writeRepetitiveString(ObjectOutput, String)IOExceptionClassNotFoundExceptionpublic static void writeString(ObjectOutput out, String s) throws IOException
IOExceptionpublic static String readString(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static void writeStringArray(ObjectOutput out, String[] array) throws IOException
IOExceptionpublic static String[] readStringArray(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static void writeStringSet(ObjectOutput out, Set<String> set) throws IOException
IOExceptionpublic static Set<String> readStringSet(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static void writeRepetitiveStringArray(ObjectOutput out, String[] array) throws IOException
IOExceptionpublic static String[] readRepetitiveStringArray(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static void writeList(ObjectOutput out, List list) throws IOException
IOExceptionpublic static List readList(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static void writeListString(ObjectOutput out, List<String> list) throws IOException
IOExceptionpublic static List<String> readListString(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static void writeMapStringString(ObjectOutput out, Map<String,String> map) throws IOException
IOExceptionpublic static Map<String,String> readMapStringString(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static void writeMapStringListString(ObjectOutput out, Map<String,List<String>> map) throws IOException
IOExceptionpublic static Map<String,List<String>> readMapStringListString(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static <T> void writeMapStringT(ObjectOutput out, Map<String,T> map) throws IOException
IOExceptionpublic static <T> Map<String,T> readMapStringT(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static void writeMapStringObject(ObjectOutput out, Map<String,Object> map) throws IOException
IOExceptionpublic static Map<String,Object> readMapStringObject(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static <T> void writeMapRepetitiveKeys(ObjectOutput out, Map<String,T> map) throws IOException
IOExceptionpublic static <T> Map<String,T> readMapRepetitiveKeys(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static void writeRepetitiveObject(ObjectOutput out, Object obj) throws IOException
IOExceptionpublic static boolean targetSupportsSmartExternalizable()
public static void writeObject(ObjectOutput out, Object obj) throws IOException
IOExceptionpublic static <T> T readRepetitiveObject(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static <T> T readObject(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static void writeObjectArray(ObjectOutput out, Object[] array) throws IOException
IOExceptionpublic static Object[] readObjectArray(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static Throwable[] readThrowableArray(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static Exception[] readExceptionArray(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static IEntryPacket[] readEntryPacketArray(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static ITemplatePacket[] readTemplatePacketArray(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static void writeObjectArrayCompressed(ObjectOutput out, Object[] array) throws IOException
IOExceptionpublic static Object[] readObjectArrayCompressed(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static void writeSwapExternalizableObject(ObjectOutput out, ISwapExternalizable swapExternalizable) throws IOException
IOExceptionpublic static <T extends ISwapExternalizable> T readSwapExternalizableObject(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static void writeNullableSwapExternalizableObject(ObjectOutput out, ISwapExternalizable swapExternalizable) throws IOException
IOExceptionpublic static <T extends ISwapExternalizable> T readNullableSwapExternalizableObject(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static void writeWithCachedStubs(ObjectOutput out, Object obj) throws IOException
IOExceptionpublic static <T> T readWithCachedStubs(ObjectInput in) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static Object readObject(ObjectInput in, SupportCodeChangeAnnotationContainer supportCodeChangeAnnotationContainer, boolean useIOUtilsReadObject) throws ClassNotFoundException, IOException
public static void serializeSupportCodeChangeCollection(ObjectOutput out, Collection collection) throws IOException
#deserializeSupportCodeChangeCollection(ObjectInput in, Collection collection))IOExceptionpublic static void deserializeSupportCodeChangeCollection(ObjectInput in, Collection collection) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static void writeShort(ObjectOutput out, short value) throws IOException
IOExceptionpublic static void writeInt(ObjectOutput out, int value) throws IOException
IOExceptionpublic static void writeLong(ObjectOutput out, long value) throws IOException
IOExceptionpublic static short readShort(ObjectInput in) throws IOException
IOExceptionpublic static int readInt(ObjectInput in) throws IOException
IOExceptionpublic static long readLong(ObjectInput in) throws IOException
IOExceptionpublic static Map<Class<?>,IClassSerializer<?>> getClassSerializers()
public static IClassSerializer<?> getDefaultSerializer()
Copyright © GigaSpaces.