@Test public void testWriteLowerMinimumSize() throws Exception { final B2FileidProvider fileid = new B2FileidProvider(session).withCache(cache); final B2LargeUploadWriteFeature feature = new B2LargeUploadWriteFeature(session, fileid); final Path container = new Path("test-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume)); final TransferStatus status = new TransferStatus(); status.setLength(-1L); final Path file = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); final OutputStream out = feature.write(file, status, new DisabledConnectionCallback()); final byte[] content = new RandomStringGenerator.Builder().build().generate(2 * 1024 * 1024).getBytes(StandardCharsets.UTF_8); final ByteArrayInputStream in = new ByteArrayInputStream(content); assertEquals(content.length, IOUtils.copy(in, out)); in.close(); out.close(); assertTrue(new B2FindFeature(session, fileid).find(file)); final byte[] compare = new byte[content.length]; final InputStream stream = new B2ReadFeature(session, fileid).read(file, new TransferStatus().length(content.length), new DisabledConnectionCallback()); IOUtils.readFully(stream, compare); stream.close(); assertArrayEquals(content, compare); new B2DeleteFeature(session, fileid).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
@Override public StatusOutputStream<VersionId> write(final Path file, final TransferStatus status, final ConnectionCallback callback) { final LargeUploadOutputStream proxy = new LargeUploadOutputStream(file, status); return new HttpResponseOutputStream<VersionId>(new MemorySegementingOutputStream(proxy, PreferencesFactory.get().getInteger("b2.upload.largeobject.size.minimum"))) { @Override public VersionId getStatus() { return proxy.getFileId(); } }; }
B2LargeUploadWriteFeature implements MultipartWrite<VersionId> { @Override public StatusOutputStream<VersionId> write(final Path file, final TransferStatus status, final ConnectionCallback callback) { final LargeUploadOutputStream proxy = new LargeUploadOutputStream(file, status); return new HttpResponseOutputStream<VersionId>(new MemorySegementingOutputStream(proxy, PreferencesFactory.get().getInteger("b2.upload.largeobject.size.minimum"))) { @Override public VersionId getStatus() { return proxy.getFileId(); } }; } }
B2LargeUploadWriteFeature implements MultipartWrite<VersionId> { @Override public StatusOutputStream<VersionId> write(final Path file, final TransferStatus status, final ConnectionCallback callback) { final LargeUploadOutputStream proxy = new LargeUploadOutputStream(file, status); return new HttpResponseOutputStream<VersionId>(new MemorySegementingOutputStream(proxy, PreferencesFactory.get().getInteger("b2.upload.largeobject.size.minimum"))) { @Override public VersionId getStatus() { return proxy.getFileId(); } }; } B2LargeUploadWriteFeature(final B2Session session, final B2FileidProvider fileid);  B2LargeUploadWriteFeature(final B2Session session, final B2FileidProvider fileid, final Find finder, final AttributesFinder attributes); }
B2LargeUploadWriteFeature implements MultipartWrite<VersionId> { @Override public StatusOutputStream<VersionId> write(final Path file, final TransferStatus status, final ConnectionCallback callback) { final LargeUploadOutputStream proxy = new LargeUploadOutputStream(file, status); return new HttpResponseOutputStream<VersionId>(new MemorySegementingOutputStream(proxy, PreferencesFactory.get().getInteger("b2.upload.largeobject.size.minimum"))) { @Override public VersionId getStatus() { return proxy.getFileId(); } }; } B2LargeUploadWriteFeature(final B2Session session, final B2FileidProvider fileid);  B2LargeUploadWriteFeature(final B2Session session, final B2FileidProvider fileid, final Find finder, final AttributesFinder attributes); @Override StatusOutputStream<VersionId> 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(); }
B2LargeUploadWriteFeature implements MultipartWrite<VersionId> { @Override public StatusOutputStream<VersionId> write(final Path file, final TransferStatus status, final ConnectionCallback callback) { final LargeUploadOutputStream proxy = new LargeUploadOutputStream(file, status); return new HttpResponseOutputStream<VersionId>(new MemorySegementingOutputStream(proxy, PreferencesFactory.get().getInteger("b2.upload.largeobject.size.minimum"))) { @Override public VersionId getStatus() { return proxy.getFileId(); } }; } B2LargeUploadWriteFeature(final B2Session session, final B2FileidProvider fileid);  B2LargeUploadWriteFeature(final B2Session session, final B2FileidProvider fileid, final Find finder, final AttributesFinder attributes); @Override StatusOutputStream<VersionId> 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();  }