/** * Read the applied delta at the current file position. After method call, * file position is directly after applied delta field. */ private ByteStringMessage<ProtocolAppliedWaveletDelta> readAppliedDelta(int length) throws IOException { if (length == 0) { return null; } byte[] bytes = new byte[length]; file.readFully(bytes); try { return ByteStringMessage.parseProtocolAppliedWaveletDelta(ByteString.copyFrom(bytes)); } catch (InvalidProtocolBufferException e) { throw new IOException(e); } }
public static WaveletDeltaRecord deserializeWaveletDeltaRecord(DBObject dbObject) throws PersistenceException { try { return new WaveletDeltaRecord( deserializeHashedVersion((DBObject) dbObject.get(FIELD_APPLIEDATVERSION)), ByteStringMessage.parseProtocolAppliedWaveletDelta(ByteString.copyFrom((byte[]) dbObject .get(FIELD_APPLIED))), deserializeTransformedWaveletDelta((DBObject) dbObject.get(FIELD_TRANSFORMED))); } catch (InvalidProtocolBufferException e) { throw new PersistenceException(e); } }
for (ByteString delta : deltas) { try { appliedDeltas.add(ByteStringMessage.parseProtocolAppliedWaveletDelta(delta)); } catch (InvalidProtocolBufferException e) { LOG.info("Invalid applied delta protobuf for incoming " + getWaveletName(), e);