@Test public void testWrite() throws Exception { final MantaWriteFeature feature = new MantaWriteFeature(session); final Path container = new MantaDirectoryFeature(session).mkdir(randomDirectory(), "", new TransferStatus()); final byte[] content = RandomUtils.nextBytes(5 * 1024 * 1024); final TransferStatus status = new TransferStatus(); status.setLength(content.length); final Path file = new Path(container, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); final HttpResponseOutputStream<Void> out = feature.write(file, status, new DisabledConnectionCallback()); final ByteArrayInputStream in = new ByteArrayInputStream(content); final byte[] buffer = new byte[32 * 1024]; assertEquals(content.length, IOUtils.copyLarge(in, out, buffer)); in.close(); out.close(); assertNull(out.getStatus()); assertTrue(new DefaultFindFeature(session).find(file)); final byte[] compare = new byte[content.length]; final InputStream stream = new MantaReadFeature(session).read(file, new TransferStatus().length(content.length), new DisabledConnectionCallback()); IOUtils.readFully(stream, compare); stream.close(); assertArrayEquals(content, compare); new MantaDeleteFeature(session).delete(Collections.singletonList(container), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
@Override public HttpResponseOutputStream<Void> write(final Path file, final TransferStatus status, final ConnectionCallback callback) { final OutputStream putStream = session.getClient().putAsOutputStream(file.getAbsolute()); return new HttpResponseOutputStream<Void>(putStream) { @Override public Void getStatus() { return null; } }; }
MantaWriteFeature implements Write<Void> { @Override public HttpResponseOutputStream<Void> write(final Path file, final TransferStatus status, final ConnectionCallback callback) { final OutputStream putStream = session.getClient().putAsOutputStream(file.getAbsolute()); return new HttpResponseOutputStream<Void>(putStream) { @Override public Void getStatus() { return null; } }; } }
MantaWriteFeature implements Write<Void> { @Override public HttpResponseOutputStream<Void> write(final Path file, final TransferStatus status, final ConnectionCallback callback) { final OutputStream putStream = session.getClient().putAsOutputStream(file.getAbsolute()); return new HttpResponseOutputStream<Void>(putStream) { @Override public Void getStatus() { return null; } }; } MantaWriteFeature(final MantaSession session);  MantaWriteFeature(final MantaSession session, final Find finder, final AttributesFinder attributes); }
MantaWriteFeature implements Write<Void> { @Override public HttpResponseOutputStream<Void> write(final Path file, final TransferStatus status, final ConnectionCallback callback) { final OutputStream putStream = session.getClient().putAsOutputStream(file.getAbsolute()); return new HttpResponseOutputStream<Void>(putStream) { @Override public Void getStatus() { return null; } }; } MantaWriteFeature(final MantaSession session);  MantaWriteFeature(final MantaSession session, final Find finder, final AttributesFinder attributes); @Override HttpResponseOutputStream<Void> write(final Path file, final TransferStatus status, final ConnectionCallback callback); @Override Append append(final Path file, final Long length, final Cache<Path> cache); @Override boolean temporary(); @Override boolean random(); }
MantaWriteFeature implements Write<Void> { @Override public HttpResponseOutputStream<Void> write(final Path file, final TransferStatus status, final ConnectionCallback callback) { final OutputStream putStream = session.getClient().putAsOutputStream(file.getAbsolute()); return new HttpResponseOutputStream<Void>(putStream) { @Override public Void getStatus() { return null; } }; } MantaWriteFeature(final MantaSession session);  MantaWriteFeature(final MantaSession session, final Find finder, final AttributesFinder attributes); @Override HttpResponseOutputStream<Void> write(final Path file, final TransferStatus status, final ConnectionCallback callback); @Override Append append(final Path file, final Long length, final Cache<Path> cache); @Override boolean temporary(); @Override boolean random();  }