@Test public void testWriteContentRangeTwoBytes() throws Exception { final DAVWriteFeature feature = new DAVWriteFeature(session); final Path test = new Path(UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); final byte[] source = RandomUtils.nextBytes(2); { final TransferStatus status = new TransferStatus(); status.setLength(1L); status.setOffset(0L); final HttpResponseOutputStream<String> out = feature.write(test, status, new DisabledConnectionCallback()); new StreamCopier(status, status).withOffset(status.getOffset()).withLimit(status.getLength()).transfer(new ByteArrayInputStream(source), out); out.close(); } { final TransferStatus status = new TransferStatus(); status.setLength(1L); status.setOffset(1L); status.setAppend(true); final HttpResponseOutputStream<String> out = feature.write(test, status, new DisabledConnectionCallback()); new StreamCopier(status, status).withOffset(status.getOffset()).withLimit(status.getLength()).transfer(new ByteArrayInputStream(source), out); out.close(); } final ByteArrayOutputStream out = new ByteArrayOutputStream(source.length); IOUtils.copy(new DAVReadFeature(session).read(test, new TransferStatus().length(source.length), new DisabledConnectionCallback()), out); assertArrayEquals(source, out.toByteArray()); new DAVDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
@Override public HttpResponseOutputStream<String> write(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final List<Header> headers = this.getHeaders(file, status); return this.write(file, headers, status); }
DAVWriteFeature extends AbstractHttpWriteFeature<String> implements Write<String> { @Override public HttpResponseOutputStream<String> write(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final List<Header> headers = this.getHeaders(file, status); return this.write(file, headers, status); } }
DAVWriteFeature extends AbstractHttpWriteFeature<String> implements Write<String> { @Override public HttpResponseOutputStream<String> write(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final List<Header> headers = this.getHeaders(file, status); return this.write(file, headers, status); } DAVWriteFeature(final DAVSession session);  DAVWriteFeature(final DAVSession session, final boolean expect);  DAVWriteFeature(final DAVSession session, final Find finder, final AttributesFinder attributes, final boolean expect); }
DAVWriteFeature extends AbstractHttpWriteFeature<String> implements Write<String> { @Override public HttpResponseOutputStream<String> write(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final List<Header> headers = this.getHeaders(file, status); return this.write(file, headers, status); } DAVWriteFeature(final DAVSession session);  DAVWriteFeature(final DAVSession session, final boolean expect);  DAVWriteFeature(final DAVSession session, final Find finder, final AttributesFinder attributes, final boolean expect); @Override HttpResponseOutputStream<String> write(final Path file, final TransferStatus status, final ConnectionCallback callback); @Override boolean temporary(); @Override boolean random(); }
DAVWriteFeature extends AbstractHttpWriteFeature<String> implements Write<String> { @Override public HttpResponseOutputStream<String> write(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException { final List<Header> headers = this.getHeaders(file, status); return this.write(file, headers, status); } DAVWriteFeature(final DAVSession session);  DAVWriteFeature(final DAVSession session, final boolean expect);  DAVWriteFeature(final DAVSession session, final Find finder, final AttributesFinder attributes, final boolean expect); @Override HttpResponseOutputStream<String> write(final Path file, final TransferStatus status, final ConnectionCallback callback); @Override boolean temporary(); @Override boolean random();  }