Interface PredefinedArray<T>
- Type Parameters:
T- the type of the predefined array
- All Known Implementing Classes:
AbstractPredefinedArrayTripType, BooleanArrayTripType, BooleanPrimitiveArrayTripType, ByteArrayTripType, BytePrimitiveArrayTripType, CharacterArrayTripType, CharacterPrimitiveArrayTripType, DoubleArrayTripType, DoublePrimitiveArrayTripType, FloatArrayTripType, FloatPrimitiveArrayTripType, IntegerArrayTripType, IntegerPrimitiveArrayTripType, LongArrayTripType, LongPrimitiveArrayTripType, ShortArrayTripType, ShortPrimitiveArrayTripType, StringArrayTripType
Predefined array types are used for primitives and their wrappers
(like boolean[], Byte[], Character[], etc.)
and String[].
Although they are final, i.e., you cannot write Boolean[] bools = new boolean[10],
they can be assigned to a variable of type Object[], which is not final.
When reading a component with a compile-type of Object[] from a stream,
the predefined array type is determined by the PredefinedArrayType which follows the OpCode.
However, since the TripTypes of predefined arrays are not dictionary-based, their TripType implementation
has no way to detect whether the runtime type was already read from the stream or not.
For those rare cases, when the type is used directly and not as a component of another object,
the method readWithType(TripStream, OpCode) must be invoked
instead of TripType.read(TripStream, OpCode).
Notice that for the reasons mentioned above, TripType.isFinal() for
predefined arrays must return false!
-
Method Summary
Modifier and TypeMethodDescriptionreadWithType(TripStream stream, OpCode opCode) Reads the predefined array from the stream, including the array type.
-
Method Details
-
readWithType
Reads the predefined array from the stream, including the array type.- Parameters:
stream- the stream to read fromopCode- the op code- Returns:
- the array
-