@Test public void byteWriterEmpty() throws Exception { byte[] bytes = new byte[0]; Publisher<DataChunk> publisher = ContentWriters.writeBytes(bytes, false); byte[] result = ContentReaders.readBytes(publisher).get(5, TimeUnit.SECONDS); assertThat(result.length, is(0)); }
public static Single<DataChunk> writeBytes(byte[] bytes, boolean copy) { byte[] data; if (copy) { data = new byte[bytes.length]; System.arraycopy(bytes, 0, data, 0, bytes.length); } else { data = bytes; } return Single.just(DataChunk.create(false, ByteBuffer.wrap(data))); }
ContentWriters { public static Single<DataChunk> writeBytes(byte[] bytes, boolean copy) { byte[] data; if (copy) { data = new byte[bytes.length]; System.arraycopy(bytes, 0, data, 0, bytes.length); } else { data = bytes; } return Single.just(DataChunk.create(false, ByteBuffer.wrap(data))); } }
ContentWriters { public static Single<DataChunk> writeBytes(byte[] bytes, boolean copy) { byte[] data; if (copy) { data = new byte[bytes.length]; System.arraycopy(bytes, 0, data, 0, bytes.length); } else { data = bytes; } return Single.just(DataChunk.create(false, ByteBuffer.wrap(data))); } private  ContentWriters(); }
ContentWriters { public static Single<DataChunk> writeBytes(byte[] bytes, boolean copy) { byte[] data; if (copy) { data = new byte[bytes.length]; System.arraycopy(bytes, 0, data, 0, bytes.length); } else { data = bytes; } return Single.just(DataChunk.create(false, ByteBuffer.wrap(data))); } private  ContentWriters(); static Single<DataChunk> writeBytes(byte[] bytes, boolean copy); static Single<DataChunk> writeCharSequence(CharSequence cs, Charset charset); static Single<DataChunk> writeCharBuffer(CharBuffer buffer, Charset charset); static Single<DataChunk> writeStackTrace(Throwable throwable, Charset charset); @Deprecated(since = "2.0.0") static Function<byte[], Publisher<DataChunk>> byteArrayWriter(boolean copy); @Deprecated(since = "2.0.0") static Function<CharSequence, Publisher<DataChunk>> charSequenceWriter(Charset charset); @Deprecated(since = "2.0.0") static Function<CharBuffer, Publisher<DataChunk>> charBufferWriter(Charset charset); @Deprecated(since = "2.0.0") static Function<ReadableByteChannel, Publisher<DataChunk>> byteChannelWriter(RetrySchema retrySchema); @Deprecated(since = "2.0.0") static Function<ReadableByteChannel, Publisher<DataChunk>> byteChannelWriter(); }
ContentWriters { public static Single<DataChunk> writeBytes(byte[] bytes, boolean copy) { byte[] data; if (copy) { data = new byte[bytes.length]; System.arraycopy(bytes, 0, data, 0, bytes.length); } else { data = bytes; } return Single.just(DataChunk.create(false, ByteBuffer.wrap(data))); } private  ContentWriters(); static Single<DataChunk> writeBytes(byte[] bytes, boolean copy); static Single<DataChunk> writeCharSequence(CharSequence cs, Charset charset); static Single<DataChunk> writeCharBuffer(CharBuffer buffer, Charset charset); static Single<DataChunk> writeStackTrace(Throwable throwable, Charset charset); @Deprecated(since = "2.0.0") static Function<byte[], Publisher<DataChunk>> byteArrayWriter(boolean copy); @Deprecated(since = "2.0.0") static Function<CharSequence, Publisher<DataChunk>> charSequenceWriter(Charset charset); @Deprecated(since = "2.0.0") static Function<CharBuffer, Publisher<DataChunk>> charBufferWriter(Charset charset); @Deprecated(since = "2.0.0") static Function<ReadableByteChannel, Publisher<DataChunk>> byteChannelWriter(RetrySchema retrySchema); @Deprecated(since = "2.0.0") static Function<ReadableByteChannel, Publisher<DataChunk>> byteChannelWriter();  }