storj/uplink-android

Upload successful, but no files

Closed this issue · 1 comments

access = uplink2.requestAccessWithPassphrase(satelliteAddress, serializedApiKey, passphrase);
try (Project project = uplink2.openProject(access);
OutputStream out = project.uploadObject("my-bucket", "test.jpg");
InputStream in = new FileInputStream(file)) {
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = in.read(buffer)) != -1) {
out.write(buffer, 0, bytesRead);
}
out.flush();
// out.close();
}

Thanks for your report. You should call .commit() before .close() is called.

ObjectOutputStream out = project.uploadObject("my-bucket", "test.jpg");

/* write */

out.commit();

/* close */