@Override
public void finishObjectCreation(RawGcsCreationToken token, ByteBuffer chunk, long timeoutMillis)
throws IOException {
Token t = append(token, chunk);
FILES.openWriteChannel(t.file, true).closeFinally();
FileStat stats = FILES.stat(t.file);
Entity e = new Entity(makeKey(t.filename));
ByteArrayOutputStream bout = new ByteArrayOutputStream();
try (ObjectOutputStream oout = new ObjectOutputStream(bout)) {
oout.writeObject(t.options);
}
e.setUnindexedProperty(OPTIONS_PROP, new Blob(bout.toByteArray()));
e.setUnindexedProperty(CREATION_TIME_PROP, System.currentTimeMillis());
e.setUnindexedProperty(FILE_LENGTH_PROP, stats.getLength());
DATASTORE.put(null, e);
}