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 int |
getCodeMapRevision() |
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
Exception
public static byte[] objectToByteBuffer(Object obj) throws Exception
Exception
public 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
IOException
public static UUID readUUID(ObjectInput in) throws IOException
IOException
public static int getCodeMapRevision()
public static void writeCodeMaps(ObjectOutput out) throws IOException
IOException
public static void readCodeMaps(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public 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 0IOException
public static void writeShortArray(ObjectOutput out, short[] array) throws IOException
IOException
public static short[] readShortArray(ObjectInput in) throws IOException
IOException
public static void writeIntegerArray(ObjectOutput out, int[] array) throws IOException
IOException
public static int[] readIntegerArray(ObjectInput in) throws IOException
IOException
public static void writeLongArray(ObjectOutput out, long[] array) throws IOException
IOException
public static long[] readLongArray(ObjectInput in) throws IOException
IOException
public static void writeByteArray(ObjectOutput out, byte[] array) throws IOException
IOException
public static byte[] readByteArray(ObjectInput in) throws IOException
IOException
public static void writeBooleanArray(ObjectOutput out, boolean[] array) throws IOException
IOException
public static boolean[] readBooleanArray(ObjectInput in) throws IOException
IOException
public static void writeRepetitiveString(ObjectOutput out, String s) throws IOException
IOException
public static String readRepetitiveString(ObjectInput in) throws IOException, ClassNotFoundException
writeRepetitiveString(ObjectOutput, String)
IOException
ClassNotFoundException
public static void writeString(ObjectOutput out, String s) throws IOException
IOException
public static String readString(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static void writeStringArray(ObjectOutput out, String[] array) throws IOException
IOException
public static String[] readStringArray(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static void writeStringSet(ObjectOutput out, Set<String> set) throws IOException
IOException
public static Set<String> readStringSet(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static void writeRepetitiveStringArray(ObjectOutput out, String[] array) throws IOException
IOException
public static String[] readRepetitiveStringArray(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static void writeList(ObjectOutput out, List list) throws IOException
IOException
public static List readList(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static void writeListString(ObjectOutput out, List<String> list) throws IOException
IOException
public static List<String> readListString(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static void writeMapStringString(ObjectOutput out, Map<String,String> map) throws IOException
IOException
public static Map<String,String> readMapStringString(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static void writeMapStringListString(ObjectOutput out, Map<String,List<String>> map) throws IOException
IOException
public static Map<String,List<String>> readMapStringListString(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static <T> void writeMapStringT(ObjectOutput out, Map<String,T> map) throws IOException
IOException
public static <T> Map<String,T> readMapStringT(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static void writeMapStringObject(ObjectOutput out, Map<String,Object> map) throws IOException
IOException
public static Map<String,Object> readMapStringObject(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static <T> void writeMapRepetitiveKeys(ObjectOutput out, Map<String,T> map) throws IOException
IOException
public static <T> Map<String,T> readMapRepetitiveKeys(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static void writeRepetitiveObject(ObjectOutput out, Object obj) throws IOException
IOException
public static boolean targetSupportsSmartExternalizable()
public static void writeObject(ObjectOutput out, Object obj) throws IOException
IOException
public static <T> T readRepetitiveObject(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static <T> T readObject(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static void writeObjectArray(ObjectOutput out, Object[] array) throws IOException
IOException
public static Object[] readObjectArray(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static Throwable[] readThrowableArray(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static Exception[] readExceptionArray(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static IEntryPacket[] readEntryPacketArray(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static ITemplatePacket[] readTemplatePacketArray(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static void writeObjectArrayCompressed(ObjectOutput out, Object[] array) throws IOException
IOException
public static Object[] readObjectArrayCompressed(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static void writeSwapExternalizableObject(ObjectOutput out, ISwapExternalizable swapExternalizable) throws IOException
IOException
public static <T extends ISwapExternalizable> T readSwapExternalizableObject(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static void writeNullableSwapExternalizableObject(ObjectOutput out, ISwapExternalizable swapExternalizable) throws IOException
IOException
public static <T extends ISwapExternalizable> T readNullableSwapExternalizableObject(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static void writeWithCachedStubs(ObjectOutput out, Object obj) throws IOException
IOException
public static <T> T readWithCachedStubs(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public 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))
IOException
public static void deserializeSupportCodeChangeCollection(ObjectInput in, Collection collection) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static void writeShort(ObjectOutput out, short value) throws IOException
IOException
public static void writeInt(ObjectOutput out, int value) throws IOException
IOException
public static void writeLong(ObjectOutput out, long value) throws IOException
IOException
public static short readShort(ObjectInput in) throws IOException
IOException
public static int readInt(ObjectInput in) throws IOException
IOException
public static long readLong(ObjectInput in) throws IOException
IOException
public static Map<Class<?>,IClassSerializer<?>> getClassSerializers()
public static IClassSerializer<?> getDefaultSerializer()
Copyright © GigaSpaces.