/** * Initializes a ProtobufCellDecoder. * * @param cellSpec Specification of the cell encoding. * @throws IOException on I/O error. */ public ProtobufCellDecoder(CellSpec cellSpec) throws IOException { Preconditions.checkNotNull(cellSpec); Preconditions.checkArgument( cellSpec.getCellSchema().getType() == SchemaType.PROTOBUF); final String className = cellSpec.getCellSchema().getProtobufClassName(); try { mProtoClass = Class.forName(className).asSubclass(AbstractMessageLite.class); } catch (ClassNotFoundException cnfe) { throw new IOException(cnfe); } try { mParseFromMethod = mProtoClass.getMethod("parseFrom", byte[].class); } catch (NoSuchMethodException nsme) { throw new IOException(nsme); } }
/** * Initializes a ProtobufCellDecoder. * * @param layout FijiTableLayout from which to get the Protobuf class name. * @param spec Specification of the cell encoding. * @throws IOException on I/O error. */ public ProtobufCellDecoder(FijiTableLayout layout, BoundColumnReaderSpec spec) throws IOException { Preconditions.checkNotNull(layout); Preconditions.checkNotNull(spec); Preconditions.checkArgument( spec.getColumnReaderSpec().getEncoding() == Encoding.PROTOBUF); final String className = layout.getCellSchema(spec.getColumn()).getProtobufClassName(); try { mProtoClass = Class.forName(className).asSubclass(AbstractMessageLite.class); } catch (ClassNotFoundException cnfe) { throw new IOException(cnfe); } try { mParseFromMethod = mProtoClass.getMethod("parseFrom", byte[].class); } catch (NoSuchMethodException nsme) { throw new IOException(nsme); } }
Preconditions.checkNotNull(mProtobufFullName); final String className = cellSpec.getCellSchema().getProtobufClassName(); Class<?> protoClass = null; try {