public void writeTo(@Nonnull DexDataStore dest) throws IOException { this.writeTo(dest, MemoryDeferredOutputStream.getFactory()); }
@Override public DeferredOutputStream makeDeferredOutputStream() { return new MemoryDeferredOutputStream(bufferSize); } };
@Override public void write(int i) throws IOException { if (remaining() == 0) { buffers.add(currentBuffer); currentBuffer = new byte[currentBuffer.length]; currentPosition = 0; } currentBuffer[currentPosition++] = (byte)i; }
@Override public void write(byte[] bytes) throws IOException { write(bytes, 0, bytes.length); }
@Override public DeferredOutputStream makeDeferredOutputStream() { return new MemoryDeferredOutputStream(bufferSize); } };
@Override public void write(int i) throws IOException { if (remaining() == 0) { buffers.add(currentBuffer); currentBuffer = new byte[currentBuffer.length]; currentPosition = 0; } currentBuffer[currentPosition++] = (byte)i; }
@Override public void write(byte[] bytes) throws IOException { write(bytes, 0, bytes.length); }
@Nonnull public static DeferredOutputStreamFactory getFactory() { return getFactory(DEFAULT_BUFFER_SIZE); }
@Override public DeferredOutputStream makeDeferredOutputStream() { return new MemoryDeferredOutputStream(bufferSize); } };
@Override public void write(int i) throws IOException { if (remaining() == 0) { buffers.add(currentBuffer); currentBuffer = new byte[currentBuffer.length]; currentPosition = 0; } currentBuffer[currentPosition++] = (byte)i; }
@Override public void write(byte[] bytes) throws IOException { write(bytes, 0, bytes.length); }
@Nonnull public static DeferredOutputStreamFactory getFactory() { return getFactory(DEFAULT_BUFFER_SIZE); }
@Nonnull public static DeferredOutputStreamFactory getFactory(final int bufferSize) { return new DeferredOutputStreamFactory() { @Override public DeferredOutputStream makeDeferredOutputStream() { return new MemoryDeferredOutputStream(bufferSize); } }; } }
@Override public void write(byte[] bytes, int offset, int length) throws IOException { int remaining = remaining(); int written = 0; while (length - written > 0) { int toWrite = Math.min(remaining, (length - written)); System.arraycopy(bytes, offset + written, currentBuffer, currentPosition, toWrite); written += toWrite; currentPosition += toWrite; remaining = remaining(); if (remaining == 0) { buffers.add(currentBuffer); currentBuffer = new byte[currentBuffer.length]; currentPosition = 0; remaining = currentBuffer.length; } } }
@Nonnull public static DeferredOutputStreamFactory getFactory() { return getFactory(DEFAULT_BUFFER_SIZE); }
@Nonnull public static DeferredOutputStreamFactory getFactory(final int bufferSize) { return new DeferredOutputStreamFactory() { @Override public DeferredOutputStream makeDeferredOutputStream() { return new MemoryDeferredOutputStream(bufferSize); } }; } }
@Override public void write(byte[] bytes, int offset, int length) throws IOException { int remaining = remaining(); int written = 0; while (length - written > 0) { int toWrite = Math.min(remaining, (length - written)); System.arraycopy(bytes, offset + written, currentBuffer, currentPosition, toWrite); written += toWrite; currentPosition += toWrite; remaining = remaining(); if (remaining == 0) { buffers.add(currentBuffer); currentBuffer = new byte[currentBuffer.length]; currentPosition = 0; remaining = currentBuffer.length; } } }
public void writeTo(@Nonnull DexDataStore dest) throws IOException { this.writeTo(dest, MemoryDeferredOutputStream.getFactory()); }
@Nonnull public static DeferredOutputStreamFactory getFactory(final int bufferSize) { return new DeferredOutputStreamFactory() { @Override public DeferredOutputStream makeDeferredOutputStream() { return new MemoryDeferredOutputStream(bufferSize); } }; } }
@Override public void write(byte[] bytes, int offset, int length) throws IOException { int remaining = remaining(); int written = 0; while (length - written > 0) { int toWrite = Math.min(remaining, (length - written)); System.arraycopy(bytes, offset + written, currentBuffer, currentPosition, toWrite); written += toWrite; currentPosition += toWrite; remaining = remaining(); if (remaining == 0) { buffers.add(currentBuffer); currentBuffer = new byte[currentBuffer.length]; currentPosition = 0; remaining = currentBuffer.length; } } }