@Override public synchronized void write(byte[] b) throws IOException { write(b, 0, b.length); }
@Override public synchronized void write(byte[] b) throws IOException { write(b, 0, b.length); }
@Override public synchronized void write(byte[] b) throws IOException { write(b, 0, b.length); }
public void testReset() throws Exception { byte[] data = newPreFilledByteArray(100); FileBackedOutputStream out = new FileBackedOutputStream(Integer.MAX_VALUE); ByteSource source = out.asByteSource(); out.write(data); assertTrue(Arrays.equals(data, source.read())); out.reset(); assertTrue(Arrays.equals(new byte[0], source.read())); out.write(data); assertTrue(Arrays.equals(data, source.read())); out.close(); } }
public void testWriteErrorAfterClose() throws Exception { byte[] data = newPreFilledByteArray(100); FileBackedOutputStream out = new FileBackedOutputStream(50); ByteSource source = out.asByteSource(); out.write(data); assertTrue(Arrays.equals(data, source.read())); out.close(); try { out.write(42); fail("expected exception"); } catch (IOException expected) { } // Verify that write had no effect assertTrue(Arrays.equals(data, source.read())); out.reset(); }
@Override public synchronized void write(byte[] b) throws IOException { write(b, 0, b.length); }
@Override public synchronized void write(byte[] b) throws IOException { write(b, 0, b.length); }
@Override public synchronized void write(byte[] b) throws IOException { write(b, 0, b.length); }
@Override public synchronized void write(byte[] b) throws IOException { write(b, 0, b.length); }
@Override public synchronized void write(byte[] b) throws IOException { write(b, 0, b.length); }
@Override public synchronized void write(byte[] b) throws IOException { write(b, 0, b.length); }
@Override public synchronized void write(byte[] b) throws IOException { write(b, 0, b.length); }
@Override public synchronized void write(byte[] b) throws IOException { write(b, 0, b.length); }
@Override public synchronized void write(byte[] b) throws IOException { write(b, 0, b.length); }
@Override public synchronized void write(byte[] b) throws IOException { write(b, 0, b.length); }
@Override public synchronized void write(byte[] b) throws IOException { write(b, 0, b.length); }
private void writeToOutputStream(RedactionType redactionType, FileBackedOutputStream fileBackedOutputStream, char[] half1) { if (redactionType != RedactionType.DO_NOTHING) { try { assert fileBackedOutputStream != null; fileBackedOutputStream.write(new String(half1).getBytes(StandardCharsets.UTF_8)); } catch (IOException e) { throw new RuntimeException(e); } } } }
@Override public void write(int b) throws IOException { checkIsClosed(); fileBackedOutputStream.write(b); }
public void testReset() throws Exception { byte[] data = newPreFilledByteArray(100); FileBackedOutputStream out = new FileBackedOutputStream(Integer.MAX_VALUE); ByteSource source = out.asByteSource(); out.write(data); assertTrue(Arrays.equals(data, source.read())); out.reset(); assertTrue(Arrays.equals(new byte[0], source.read())); out.write(data); assertTrue(Arrays.equals(data, source.read())); out.close(); } }