|
|
@ -36,13 +36,12 @@ import java.io.OutputStream; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
import java.nio.ByteBuffer; |
|
|
|
import java.nio.ByteBuffer; |
|
|
|
import java.util.ArrayDeque; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Deque; |
|
|
|
|
|
|
|
import java.util.Iterator; |
|
|
|
import java.util.Iterator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.NoSuchElementException; |
|
|
|
import java.util.NoSuchElementException; |
|
|
|
|
|
|
|
import java.util.Stack; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Class to represent {@code ByteStrings} formed by concatenation of other |
|
|
|
* Class to represent {@code ByteStrings} formed by concatenation of other |
|
|
@ -590,8 +589,7 @@ class RopeByteString extends ByteString { |
|
|
|
// Stack containing the part of the string, starting from the left, that
|
|
|
|
// Stack containing the part of the string, starting from the left, that
|
|
|
|
// we've already traversed. The final string should be the equivalent of
|
|
|
|
// we've already traversed. The final string should be the equivalent of
|
|
|
|
// concatenating the strings on the stack from bottom to top.
|
|
|
|
// concatenating the strings on the stack from bottom to top.
|
|
|
|
private final Deque<ByteString> prefixesStack = |
|
|
|
private final Stack<ByteString> prefixesStack = new Stack<ByteString>(); |
|
|
|
new ArrayDeque<ByteString>(minLengthByDepth.length); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ByteString balance(ByteString left, ByteString right) { |
|
|
|
private ByteString balance(ByteString left, ByteString right) { |
|
|
|
doBalance(left); |
|
|
|
doBalance(left); |
|
|
@ -703,8 +701,8 @@ class RopeByteString extends ByteString { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private static class PieceIterator implements Iterator<LiteralByteString> { |
|
|
|
private static class PieceIterator implements Iterator<LiteralByteString> { |
|
|
|
|
|
|
|
|
|
|
|
private final Deque<RopeByteString> breadCrumbs = |
|
|
|
private final Stack<RopeByteString> breadCrumbs = |
|
|
|
new ArrayDeque<RopeByteString>(minLengthByDepth.length); |
|
|
|
new Stack<RopeByteString>(); |
|
|
|
private LiteralByteString next; |
|
|
|
private LiteralByteString next; |
|
|
|
|
|
|
|
|
|
|
|
private PieceIterator(ByteString root) { |
|
|
|
private PieceIterator(ByteString root) { |
|
|
|