diff --git a/android/guava/src/com/google/common/io/ByteStreams.java b/android/guava/src/com/google/common/io/ByteStreams.java index 868d200ca6f9..05d77cd9a68a 100644 --- a/android/guava/src/com/google/common/io/ByteStreams.java +++ b/android/guava/src/com/google/common/io/ByteStreams.java @@ -40,7 +40,7 @@ import java.nio.channels.WritableByteChannel; import java.util.ArrayDeque; import java.util.Arrays; -import java.util.Deque; +import java.util.Queue; /** * Provides utility methods for working with byte arrays and I/O streams. @@ -165,7 +165,7 @@ public static long copy(ReadableByteChannel from, WritableByteChannel to) throws * a total combined length of {@code totalLen} bytes) followed by all bytes remaining in the given * input stream. */ - private static byte[] toByteArrayInternal(InputStream in, Deque bufs, int totalLen) + private static byte[] toByteArrayInternal(InputStream in, Queue bufs, int totalLen) throws IOException { // Starting with an 8k buffer, double the size of each sucessive buffer. Buffers are retained // in a deque so that there's no copying between buffers while reading and so all of the bytes @@ -196,11 +196,11 @@ private static byte[] toByteArrayInternal(InputStream in, Deque bufs, in } } - private static byte[] combineBuffers(Deque bufs, int totalLen) { + private static byte[] combineBuffers(Queue bufs, int totalLen) { byte[] result = new byte[totalLen]; int remaining = totalLen; while (remaining > 0) { - byte[] buf = bufs.removeFirst(); + byte[] buf = bufs.remove(); int bytesToCopy = Math.min(remaining, buf.length); int resultOffset = totalLen - remaining; System.arraycopy(buf, 0, result, resultOffset, bytesToCopy); @@ -253,7 +253,7 @@ static byte[] toByteArray(InputStream in, long expectedSize) throws IOException } // the stream was longer, so read the rest normally - Deque bufs = new ArrayDeque(TO_BYTE_ARRAY_DEQUE_SIZE + 2); + Queue bufs = new ArrayDeque(TO_BYTE_ARRAY_DEQUE_SIZE + 2); bufs.add(bytes); bufs.add(new byte[] {(byte) b}); return toByteArrayInternal(in, bufs, bytes.length + 1); diff --git a/guava/src/com/google/common/io/ByteStreams.java b/guava/src/com/google/common/io/ByteStreams.java index 868d200ca6f9..05d77cd9a68a 100644 --- a/guava/src/com/google/common/io/ByteStreams.java +++ b/guava/src/com/google/common/io/ByteStreams.java @@ -40,7 +40,7 @@ import java.nio.channels.WritableByteChannel; import java.util.ArrayDeque; import java.util.Arrays; -import java.util.Deque; +import java.util.Queue; /** * Provides utility methods for working with byte arrays and I/O streams. @@ -165,7 +165,7 @@ public static long copy(ReadableByteChannel from, WritableByteChannel to) throws * a total combined length of {@code totalLen} bytes) followed by all bytes remaining in the given * input stream. */ - private static byte[] toByteArrayInternal(InputStream in, Deque bufs, int totalLen) + private static byte[] toByteArrayInternal(InputStream in, Queue bufs, int totalLen) throws IOException { // Starting with an 8k buffer, double the size of each sucessive buffer. Buffers are retained // in a deque so that there's no copying between buffers while reading and so all of the bytes @@ -196,11 +196,11 @@ private static byte[] toByteArrayInternal(InputStream in, Deque bufs, in } } - private static byte[] combineBuffers(Deque bufs, int totalLen) { + private static byte[] combineBuffers(Queue bufs, int totalLen) { byte[] result = new byte[totalLen]; int remaining = totalLen; while (remaining > 0) { - byte[] buf = bufs.removeFirst(); + byte[] buf = bufs.remove(); int bytesToCopy = Math.min(remaining, buf.length); int resultOffset = totalLen - remaining; System.arraycopy(buf, 0, result, resultOffset, bytesToCopy); @@ -253,7 +253,7 @@ static byte[] toByteArray(InputStream in, long expectedSize) throws IOException } // the stream was longer, so read the rest normally - Deque bufs = new ArrayDeque(TO_BYTE_ARRAY_DEQUE_SIZE + 2); + Queue bufs = new ArrayDeque(TO_BYTE_ARRAY_DEQUE_SIZE + 2); bufs.add(bytes); bufs.add(new byte[] {(byte) b}); return toByteArrayInternal(in, bufs, bytes.length + 1);