Added Consumer support to Writer, to avoid redundant copying.

This commit is contained in:
akwizgran
2011-09-28 18:47:24 +01:00
parent 9c2e3917bf
commit a8b96f11fd
12 changed files with 134 additions and 97 deletions

View File

@@ -130,7 +130,12 @@ public class FileReadWriteTest extends TestCase {
}
@Test
public void testWriteFile() throws Exception {
public void testWriteAndRead() throws Exception {
write();
read();
}
private void write() throws Exception {
OutputStream out = new FileOutputStream(file);
// Use Alice's secret for writing
ConnectionWriter w = connectionWriterFactory.createConnectionWriter(out,
@@ -177,10 +182,7 @@ public class FileReadWriteTest extends TestCase {
assertTrue(file.length() > message.getSize());
}
@Test
public void testWriteAndReadFile() throws Exception {
testWriteFile();
private void read() throws Exception {
InputStream in = new FileInputStream(file);
byte[] iv = new byte[16];

View File

@@ -416,10 +416,6 @@ public class ReaderImplTest extends TestCase {
out.write(b);
}
public void write(byte[] b) throws IOException {
out.write(b);
}
public void write(byte[] b, int off, int len) throws IOException {
out.write(b, off, len);
}