Decodes a Paste operation.

@param blockSize_S
length of a S block
@param blockSize_B
length of a B block
@return DiffPart, Paste operation

@throws DecodingException
if the decoding failed
438825
private DiffPart decodePaste(final int blockSize_S, final int blockSize_B,
			final BitReader r)
		throws DecodingException
	{

		if (blockSize_S < 1 || blockSize_B < 1) {
			throw new DecodingException("Invalid value for blockSize_S: "
					+ blockSize_S + " or blockSize_B: " + blockSize_B);
		}

		int s = r.read(blockSize_S);
		int b = r.read(blockSize_B);

		DiffPart part = new DiffPart(DiffAction.PASTE);
		part.setStart(s);
		part.setText(Integer.toString(b));

		r.skip();

		return part;
	}
429828
private void validateBlockSize(byte[] descriptor) throws IOException {
        int blockSize = Util.getUInt16Both(descriptor, 129);
        if (blockSize != Constants.DEFAULT_BLOCK_SIZE) {
            throw new LoopFileSystemException("Invalid block size: " + blockSize);
        }
    }
152458
private static byte[] oneBlock(byte[] buffer, InputStream in, int len) throws IOException {
        MessageDigest sha1 = null;
        try {
            sha1 = MessageDigest.getInstance("sha-1");
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            //never reach
            return null;
        }
        int buffSize = buffer.length;
        while (len != 0) {
            int next = buffSize > len ? len : buffSize;
            //noinspection ResultOfMethodCallIgnored
            in.read(buffer, 0, next);
            sha1.update(buffer, 0, next);
            len -= next;
        }

        return sha1.digest();
    }
52453
@Override
    public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException {
        if ( this.largeFile ) {
            this.pid = SMBUtil.readInt2(buffer, bufferIndex);
            int boHigh = SMBUtil.readInt4(buffer, bufferIndex + 4);
            int boLow = SMBUtil.readInt4(buffer, bufferIndex + 8);

            this.byteOffset = ( boHigh << 32 ) | boLow;

            int lHigh = SMBUtil.readInt4(buffer, bufferIndex + 12);
            int lLow = SMBUtil.readInt4(buffer, bufferIndex + 16);

            this.lengthInBytes = ( lHigh << 32 ) | lLow;
            return 20;
        }
        this.pid = SMBUtil.readInt2(buffer, bufferIndex);
        this.byteOffset = SMBUtil.readInt4(buffer, bufferIndex + 2);
        this.lengthInBytes = SMBUtil.readInt4(buffer, bufferIndex + 6);
        return 10;
    }
53406
private void decodeBitmapData(GifFrame frame) {
        workBufferSize = 0;
        workBufferPosition = 0;
        if (frame != null) {
            // Jump to the frame start position.
            rawData.position(frame.bufferFrameStart);
        }

        int npix = (frame == null) ? header.width * header.height : frame.iw * frame.ih;
        int available, clear, codeMask, codeSize, endOfInformation, inCode, oldCode, bits, code, count,
                i, datum,
                dataSize, first, top, bi, pi;

        if (mainPixels == null || mainPixels.length < npix) {
            // Allocate new pixel array.
            mainPixels = bitmapProvider.obtainByteArray(npix);
        }
        if (prefix == null) {
            prefix = new short[MAX_STACK_SIZE];
        }
        if (suffix == null) {
            suffix = new byte[MAX_STACK_SIZE];
        }
        if (pixelStack == null) {
            pixelStack = new byte[MAX_STACK_SIZE + 1];
        }

        // Initialize GIF data stream decoder.
        dataSize = readByte();
        clear = 1 << dataSize;
        endOfInformation = clear + 1;
        available = clear + 2;
        oldCode = NULL_CODE;
        codeSize = dataSize + 1;
        codeMask = (1 << codeSize) - 1;
        for (code = 0; code < clear; code++) {
            // XXX ArrayIndexOutOfBoundsException.
            prefix[code] = 0;
            suffix[code] = (byte) code;
        }

        // Decode GIF pixel stream.
        datum = bits = count = first = top = pi = bi = 0;
        for (i = 0; i < npix; ) {
            // Load bytes until there are enough bits for a code.
            if (count == 0) {
                // Read a new data block.
                count = readBlock();
                if (count <= 0) {
                    status = STATUS_PARTIAL_DECODE;
                    break;
                }
                bi = 0;
            }

            datum += (((int) block[bi]) & 0xff) << bits;
            bits += 8;
            bi++;
            count--;

            while (bits >= codeSize) {
                // Get the next code.
                code = datum & codeMask;
                datum >>= codeSize;
                bits -= codeSize;

                // Interpret the code.
                if (code == clear) {
                    // Reset decoder.
                    codeSize = dataSize + 1;
                    codeMask = (1 << codeSize) - 1;
                    available = clear + 2;
                    oldCode = NULL_CODE;
                    continue;
                }

                if (code > available) {
                    status = STATUS_PARTIAL_DECODE;
                    break;
                }

                if (code == endOfInformation) {
                    break;
                }

                if (oldCode == NULL_CODE) {
                    pixelStack[top++] = suffix[code];
                    oldCode = code;
                    first = code;
                    continue;
                }
                inCode = code;
                if (code >= available) {
                    pixelStack[top++] = (byte) first;
                    code = oldCode;
                }
                while (code >= clear) {
                    pixelStack[top++] = suffix[code];
                    code = prefix[code];
                }
                first = ((int) suffix[code]) & 0xff;
                pixelStack[top++] = (byte) first;

                // Add a new string to the string table.
                if (available < MAX_STACK_SIZE) {
                    prefix[available] = (short) oldCode;
                    suffix[available] = (byte) first;
                    available++;
                    if (((available & codeMask) == 0) && (available < MAX_STACK_SIZE)) {
                        codeSize++;
                        codeMask += available;
                    }
                }
                oldCode = inCode;

                while (top > 0) {
                    // Pop a pixel off the pixel stack.
                    mainPixels[pi++] = pixelStack[--top];
                    i++;
                }
            }
        }

        // Clear missing pixels.
        for (i = pi; i < npix; i++) {
            mainPixels[i] = 0;
        }
    }
1161271
public static Double decodeDoubleObjDesc(byte[] src, int srcOffset)
        throws CorruptEncodingException
    {
        long bits = DataDecoder.decodeDoubleBits(src, srcOffset);
        if (bits >= 0) {
            bits ^= 0x7fffffffffffffffL;
        }
        return bits == 0x7fffffffffffffffL ? null : Double.longBitsToDouble(bits);
    }
772978
private static byte[] withCorrectBlockSize(final byte[] key) {
        if (key.length != CcAes.BLOCK) {
            throw new IllegalArgumentException(
                String.format(
                    "the length of the AES key must be exactly %d bytes",
                    CcAes.BLOCK
                )
            );
        }
        return key;
    }
658791
public static long getFileLengthFromBlockSize(long blockSize,
      int bytesPerChecksum, int checksumSize) {
    long numChunks; 
    if (blockSize % bytesPerChecksum == 0) {    
      numChunks = blockSize / bytesPerChecksum; 
    } else {    
      numChunks = blockSize / bytesPerChecksum + 1; 
    }   
    return blockSize + numChunks * checksumSize 
        + BlockInlineChecksumReader.getHeaderSize();  
  }
182523
public static int decode(WsByteBuffer headerBlock, int N) {

        // if (!headerBlock.hasRemaining()) {
        //     throw new HeaderFieldDecodingException("No length to decode");
        // }

        int I = HpackUtils.getLSB(headerBlock.get(), N);

        if (I < HpackUtils.ipow(2, N) - 1) {
            return I;
        } else {
            int M = 0;
            boolean done = false;

            byte b;
            while (done == false) {
                // If there are no further elements, this is an invalid HeaderBlock.
                // If this decode method is called, there should always be header
                // key value bytes after the integer representation.
                //  if (!headerBlock.hasRemaining()) {
                //     throw new HeaderFieldDecodingException("");
                // }
                b = headerBlock.get();

                I = I + ((b) & 127) * HpackUtils.ipow(2, M);
                M = M + 7;
                if (((b & 128) == 128) == false)
                    done = true;
            }

            return I;
        }

    }
961999
public SequenceGenerator.SequenceBlock allocateBlock(int blockSize) {
        final long l = this.last;
        SequenceGenerator.SequenceBlock block =
                new SequenceGenerator.SequenceBlock(l + 1, l + blockSize);
        this.last = l + blockSize;

        return block;
    }
532650
public static double decodeDouble(byte[] src, int srcOffset)
        throws CorruptEncodingException
    {
        long bits = decodeDoubleBits(src, srcOffset);
        bits ^= (bits < 0) ? 0x8000000000000000L : 0xffffffffffffffffL;
        return Double.longBitsToDouble(bits);
    }
390233
public static Long decodeLongObj(byte[] src, int srcOffset)
        throws CorruptEncodingException
    {
        try {
            int b = src[srcOffset];
            if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) {
                return null;
            }
            return decodeLong(src, srcOffset + 1);
        } catch (IndexOutOfBoundsException e) {
            throw new CorruptEncodingException(null, e);
        }
    }
1329773
public byte[] convertBlock(int[] input, int inPos, byte[] output, int numOfComponents, int startCoordinate,
                               int row, int scanlineStride) {
        int index = 0, inputOffset = 0, bounds = 0;
        int len = output.length;

        for (int i = 0; i < DCTSIZE; i++) {
            index = startCoordinate + i * scanlineStride;
            bounds = row * scanlineStride;

            for (int j = 0; j < DCTSIZE; j++) {
                if (index >= len) {
                    return output;
                }

                if (index < bounds) {
                    for (int c = 0; c < numOfComponents; c++) {
                        output[index++] = (byte) (255 - (input[inputOffset++] & 0xFF));
                    }
                } else {
                    inputOffset += numOfComponents;
                }
            }

            row++;
        }

        return output;
    }
1293146
public static int decodeInt(byte[] src, int srcOffset)
        throws CorruptEncodingException
    {
        try {
            int value = (src[srcOffset] << 24) | ((src[srcOffset + 1] & 0xff) << 16) |
                ((src[srcOffset + 2] & 0xff) << 8) | (src[srcOffset + 3] & 0xff);
            return value ^ 0x80000000;
        } catch (IndexOutOfBoundsException e) {
            throw new CorruptEncodingException(null, e);
        }
    }
262828
public static byte[] decode(final byte[] input) {
		final int lenInput = findEnd(input);
		final int lenOutput = (lenInput * BITS_PER_B64_BYTE / 8);
		final byte[] output = new byte[lenOutput];
		final byte[] transTable = DECODE_TABLE;
		for (int i = 0, j = 0; i < lenInput; i += BYTES_PER_BLOCK_OF_6_BITS) {
			final int b1 = transTable[getByte(input, i)];
			final int b2 = transTable[getByte(input, i + 1)];
			final int b3 = transTable[getByte(input, i + 2)];
			final int b4 = transTable[getByte(input, i + 3)];
			final long block = ((b1 << 18) | (b2 << 12) | (b3 << 6) | b4) & 0x00FFFFFF;
			final byte x1 = (byte) ((block >> 16) & 0xFF);
			final byte x2 = (byte) ((block >> 8) & 0xFF);
			final byte x3 = (byte) (block & 0xFF);
			setByte(output, j++, lenOutput, x1);
			setByte(output, j++, lenOutput, x2);
			setByte(output, j++, lenOutput, x3);
		}
		return output;
	}
650501
public static Double decodeDoubleObj(byte[] src, int srcOffset)
        throws CorruptEncodingException
    {
        long bits = decodeDoubleBits(src, srcOffset);
        bits ^= (bits < 0) ? 0x8000000000000000L : 0xffffffffffffffffL;
        return bits == 0x7fffffffffffffffL ? null : Double.longBitsToDouble(bits);
    }
393371
public static long decodeLong(byte[] src, int srcOffset)
        throws CorruptEncodingException
    {
        try {
            return
                (((long)(((src[srcOffset    ]       ) << 24) |
                         ((src[srcOffset + 1] & 0xff) << 16) |
                         ((src[srcOffset + 2] & 0xff) << 8 ) |
                         ((src[srcOffset + 3] & 0xff)      )) ^ 0x80000000 ) << 32) |
                (((long)(((src[srcOffset + 4]       ) << 24) |
                         ((src[srcOffset + 5] & 0xff) << 16) |
                         ((src[srcOffset + 6] & 0xff) << 8 ) |
                         ((src[srcOffset + 7] & 0xff)      )) & 0xffffffffL)      );
        } catch (IndexOutOfBoundsException e) {
            throw new CorruptEncodingException(null, e);
        }
    }