private boolean resize(int newCapacity) {
        if (outCapacity >= newCapacity) return true;
        byte[] newBuffer = new byte[newCapacity];
        System.arraycopy(buffer, 0, newBuffer, 0, Math.min(outBlurbs + ((outBits != 0) ? 1 : 0), newCapacity));
        if (newCapacity < outBlurbs + ((outBits != 0) ? 1 : 0)) {
            outBlurbs = newCapacity;
            outBits = 0;
            totalBits = newCapacity << 3;
        }
        if (newCapacity < consumedBlurbs + ((consumedBits != 0) ? 1 : 0)) {
            consumedBlurbs = newCapacity;
            consumedBits = 0;
            totalConsumedBits = newCapacity << 3;
        }
        buffer = newBuffer;
        outCapacity = newCapacity;
        return true;
    }