FileDocCategorySizeDatePackage
MarshalQueryablePrimitive.javaAPI DocAndroid 5.1 API7207Thu Mar 12 22:22:10 GMT 2015android.hardware.camera2.marshal.impl

MarshalQueryablePrimitive

public final class MarshalQueryablePrimitive extends Object implements android.hardware.camera2.marshal.MarshalQueryable
Marshal/unmarshal built-in primitive types to and from a {@link ByteBuffer}.

The following list of type marshaling is supported:

  • byte <-> TYPE_BYTE
  • int <-> TYPE_INT32
  • long <-> TYPE_INT64
  • float <-> TYPE_FLOAT
  • double <-> TYPE_DOUBLE
  • Rational <-> TYPE_RATIONAL

Due to the nature of generics, values are always boxed; this also means that both the boxed and unboxed types are supported (i.e. both {@code int} and {@code Integer}).

Each managed type must correspond 1:1 to the native type (e.g. a byte will not map to a {@link CameraMetadataNative#TYPE_INT32 TYPE_INT32} or vice versa) for marshaling.

Fields Summary
Constructors Summary
Methods Summary
public android.hardware.camera2.marshal.MarshalercreateMarshaler(android.hardware.camera2.utils.TypeReference managedType, int nativeType)

        return new MarshalerPrimitive(managedType, nativeType);
    
public booleanisTypeMappingSupported(android.hardware.camera2.utils.TypeReference managedType, int nativeType)

        if (managedType.getType() instanceof Class<?>) {
            Class<?> klass = (Class<?>)managedType.getType();

            if (klass == byte.class || klass == Byte.class) {
                return nativeType == TYPE_BYTE;
            } else if (klass == int.class || klass == Integer.class) {
                return nativeType == TYPE_INT32;
            } else if (klass == float.class || klass == Float.class) {
                return nativeType == TYPE_FLOAT;
            } else if (klass == long.class || klass == Long.class) {
                return nativeType == TYPE_INT64;
            } else if (klass == double.class || klass == Double.class) {
                return nativeType == TYPE_DOUBLE;
            } else if (klass == Rational.class) {
                return nativeType == TYPE_RATIONAL;
            }
        }
        return false;