Package org.geotools.gce.imagemosaic
Class RemappingFilteringObjectInputStream
Object
InputStream
ObjectInputStream
RemappingFilteringObjectInputStream
- All Implemented Interfaces:
Closeable
,DataInput
,ObjectInput
,ObjectStreamConstants
,AutoCloseable
An ObjectInputStream that supports:
- validation of class names (exact, primitive, regex) before deserialization;
- remapping of class names (exact or package prefix) during deserialization; and
- optionally replacing the stream's class descriptor with the local one when a class is remapped, avoiding InvalidClassException due to mismatched SUIDs.
The validation step is performed first, on the original class name from the stream. If validation fails, an InvalidClassException is thrown. If validation passes, remapping is applied (if any) and the (possibly remapped) class is loaded.
Array types are supported, including multidimensional arrays and arrays of primitives. Array types are validated and remapped based on their element type.
This class also supports chaining with a JEP 290 ObjectInputFilter for additional filtering.
This class is NOT thread-safe; use a separate instance per thread.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Builder for RemappingFilteringObjectInputStream.Nested classes/interfaces inherited from class ObjectInputStream
ObjectInputStream.GetField
-
Field Summary
Fields inherited from interface ObjectStreamConstants
baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_ENUM, SC_EXTERNALIZABLE, SC_SERIALIZABLE, SC_WRITE_METHOD, SERIAL_FILTER_PERMISSION, STREAM_MAGIC, STREAM_VERSION, SUBCLASS_IMPLEMENTATION_PERMISSION, SUBSTITUTION_PERMISSION, TC_ARRAY, TC_BASE, TC_BLOCKDATA, TC_BLOCKDATALONG, TC_CLASS, TC_CLASSDESC, TC_ENDBLOCKDATA, TC_ENUM, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Create a builder for RemappingFilteringObjectInputStream.protected ObjectStreamClass
During deserialization, the stream's class descriptor is read first.protected Class<?>
Load a class, after validating and remapping its name as needed.protected Class<?>
resolveProxyClass
(String[] interfaces) Load a dynamic proxy class, after validating and remapping its interfaces as needed.Methods inherited from class ObjectInputStream
available, close, defaultReadObject, enableResolveObject, getObjectInputFilter, read, read, readBoolean, readByte, readChar, readDouble, readFields, readFloat, readFully, readFully, readInt, readLine, readLong, readObject, readObjectOverride, readShort, readStreamHeader, readUnshared, readUnsignedByte, readUnsignedShort, readUTF, registerValidation, resolveObject, setObjectInputFilter, skipBytes
Methods inherited from class InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ObjectInput
read, skip
-
Method Details
-
resolveClass
Load a class, after validating and remapping its name as needed.- Overrides:
resolveClass
in classObjectInputStream
- Throws:
IOException
ClassNotFoundException
-
resolveProxyClass
protected Class<?> resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException Load a dynamic proxy class, after validating and remapping its interfaces as needed.- Overrides:
resolveProxyClass
in classObjectInputStream
- Throws:
IOException
ClassNotFoundException
-
readClassDescriptor
During deserialization, the stream's class descriptor is read first. If the class is remapped, we attempt to replace the stream's descriptor with the local one, avoiding InvalidClassException due to mismatched SUIDs.- Overrides:
readClassDescriptor
in classObjectInputStream
- Throws:
IOException
ClassNotFoundException
-
builder
Create a builder for RemappingFilteringObjectInputStream.
-