196 *
197 * @author Mike Warres
198 * @author Roger Riggs
199 * @see java.io.DataInput
200 * @see java.io.ObjectOutputStream
201 * @see java.io.Serializable
202 * @see <a href="../../../platform/serialization/spec/input.html"> Object Serialization Specification, Section 3, Object Input Classes</a>
203 * @since JDK1.1
204 */
205 public class ObjectInputStream
206 extends InputStream implements ObjectInput, ObjectStreamConstants
207 {
208 /** handle value representing null */
209 private static final int NULL_HANDLE = -1;
210
211 /** marker for unshared objects in internal handle table */
212 private static final Object unsharedMarker = new Object();
213
214 /** table mapping primitive type names to corresponding class objects */
215 private static final HashMap<String, Class<?>> primClasses
216 = new HashMap<String, Class<?>>(8, 1.0F);
217 static {
218 primClasses.put("boolean", boolean.class);
219 primClasses.put("byte", byte.class);
220 primClasses.put("char", char.class);
221 primClasses.put("short", short.class);
222 primClasses.put("int", int.class);
223 primClasses.put("long", long.class);
224 primClasses.put("float", float.class);
225 primClasses.put("double", double.class);
226 primClasses.put("void", void.class);
227 }
228
229 private static class Caches {
230 /** cache of subclass security audit results */
231 static final ConcurrentMap<WeakClassKey,Boolean> subclassAudits =
232 new ConcurrentHashMap<WeakClassKey,Boolean>();
233
234 /** queue for WeakReferences to audited subclasses */
235 static final ReferenceQueue<Class<?>> subclassAuditsQueue =
236 new ReferenceQueue<Class<?>>();
237 }
238
239 /** filter stream for handling block data conversion */
240 private final BlockDataInputStream bin;
241 /** validation callback list */
242 private final ValidationList vlist;
243 /** recursion depth */
244 private int depth;
245 /** whether stream is closed */
246 private boolean closed;
247
248 /** wire handle -> obj/exception map */
249 private final HandleTable handles;
250 /** scratch field for passing handle values up/down call stack */
251 private int passHandle = NULL_HANDLE;
252 /** flag set when at end of field value block with no TC_ENDBLOCKDATA */
253 private boolean defaultDataEnd = false;
254
255 /** buffer for reading primitive field values */
256 private byte[] primVals;
|
196 *
197 * @author Mike Warres
198 * @author Roger Riggs
199 * @see java.io.DataInput
200 * @see java.io.ObjectOutputStream
201 * @see java.io.Serializable
202 * @see <a href="../../../platform/serialization/spec/input.html"> Object Serialization Specification, Section 3, Object Input Classes</a>
203 * @since JDK1.1
204 */
205 public class ObjectInputStream
206 extends InputStream implements ObjectInput, ObjectStreamConstants
207 {
208 /** handle value representing null */
209 private static final int NULL_HANDLE = -1;
210
211 /** marker for unshared objects in internal handle table */
212 private static final Object unsharedMarker = new Object();
213
214 /** table mapping primitive type names to corresponding class objects */
215 private static final HashMap<String, Class<?>> primClasses
216 = new HashMap<>(8, 1.0F);
217 static {
218 primClasses.put("boolean", boolean.class);
219 primClasses.put("byte", byte.class);
220 primClasses.put("char", char.class);
221 primClasses.put("short", short.class);
222 primClasses.put("int", int.class);
223 primClasses.put("long", long.class);
224 primClasses.put("float", float.class);
225 primClasses.put("double", double.class);
226 primClasses.put("void", void.class);
227 }
228
229 private static class Caches {
230 /** cache of subclass security audit results */
231 static final ConcurrentMap<WeakClassKey,Boolean> subclassAudits =
232 new ConcurrentHashMap<>();
233
234 /** queue for WeakReferences to audited subclasses */
235 static final ReferenceQueue<Class<?>> subclassAuditsQueue =
236 new ReferenceQueue<>();
237 }
238
239 /** filter stream for handling block data conversion */
240 private final BlockDataInputStream bin;
241 /** validation callback list */
242 private final ValidationList vlist;
243 /** recursion depth */
244 private int depth;
245 /** whether stream is closed */
246 private boolean closed;
247
248 /** wire handle -> obj/exception map */
249 private final HandleTable handles;
250 /** scratch field for passing handle values up/down call stack */
251 private int passHandle = NULL_HANDLE;
252 /** flag set when at end of field value block with no TC_ENDBLOCKDATA */
253 private boolean defaultDataEnd = false;
254
255 /** buffer for reading primitive field values */
256 private byte[] primVals;
|