/** {@inheritDoc} */ @Override protected synchronized void storeDataBlock(ByteBuffer block) throws GridException, IOException { int writeLen = block.remaining(); preStoreDataBlocks(null, writeLen); int blockSize = fileInfo.blockSize(); // If data length is not enough to fill full block, fill the remainder and return. if (remainderDataLen + writeLen < blockSize) { if (remainder == null) remainder = new byte[blockSize]; else if (remainder.length != blockSize) { assert remainderDataLen == remainder.length; byte[] allocated = new byte[blockSize]; U.arrayCopy(remainder, 0, allocated, 0, remainder.length); remainder = allocated; } block.get(remainder, remainderDataLen, writeLen); remainderDataLen += writeLen; } else { remainder = data.storeDataBlocks(fileInfo, fileInfo.length() + space, remainder, remainderDataLen, block, false, streamRange, batch); remainderDataLen = remainder == null ? 0 : remainder.length; } }
/** {@inheritDoc} */ @Override protected synchronized void storeDataBlock(ByteBuffer block) throws GridException, IOException { int writeLen = block.remaining(); preStoreDataBlocks(null, writeLen); int blockSize = fileInfo.blockSize(); // If data length is not enough to fill full block, fill the remainder and return. if (remainderDataLen + writeLen < blockSize) { if (remainder == null) remainder = new byte[blockSize]; else if (remainder.length != blockSize) { assert remainderDataLen == remainder.length; byte[] allocated = new byte[blockSize]; U.arrayCopy(remainder, 0, allocated, 0, remainder.length); remainder = allocated; } block.get(remainder, remainderDataLen, writeLen); remainderDataLen += writeLen; } else { remainder = data.storeDataBlocks(fileInfo, fileInfo.length() + space, remainder, remainderDataLen, block, false, streamRange, batch); remainderDataLen = remainder == null ? 0 : remainder.length; } }
/** {@inheritDoc} */ @Override protected synchronized void storeDataBlocks(DataInput in, int len) throws GridException, IOException { preStoreDataBlocks(in, len); int blockSize = fileInfo.blockSize(); // If data length is not enough to fill full block, fill the remainder and return. if (remainderDataLen + len < blockSize) { if (remainder == null) remainder = new byte[blockSize]; else if (remainder.length != blockSize) { assert remainderDataLen == remainder.length; byte[] allocated = new byte[blockSize]; U.arrayCopy(remainder, 0, allocated, 0, remainder.length); remainder = allocated; } in.readFully(remainder, remainderDataLen, len); remainderDataLen += len; } else { remainder = data.storeDataBlocks(fileInfo, fileInfo.length() + space, remainder, remainderDataLen, in, len, false, streamRange, batch); remainderDataLen = remainder == null ? 0 : remainder.length; } }
/** {@inheritDoc} */ @Override protected synchronized void storeDataBlocks(DataInput in, int len) throws GridException, IOException { preStoreDataBlocks(in, len); int blockSize = fileInfo.blockSize(); // If data length is not enough to fill full block, fill the remainder and return. if (remainderDataLen + len < blockSize) { if (remainder == null) remainder = new byte[blockSize]; else if (remainder.length != blockSize) { assert remainderDataLen == remainder.length; byte[] allocated = new byte[blockSize]; U.arrayCopy(remainder, 0, allocated, 0, remainder.length); remainder = allocated; } in.readFully(remainder, remainderDataLen, len); remainderDataLen += len; } else { remainder = data.storeDataBlocks(fileInfo, fileInfo.length() + space, remainder, remainderDataLen, in, len, false, streamRange, batch); remainderDataLen = remainder == null ? 0 : remainder.length; } }