static <I extends DataItem, O extends DataIoTask<I>> boolean invokeCopy( final I fileItem, final O ioTask, final FileChannel srcChannel, final FileChannel dstChannel ) throws IOException { long countBytesDone = ioTask.getCountBytesDone(); final long contentSize = fileItem.size(); if(countBytesDone < contentSize && IoTask.Status.ACTIVE.equals(ioTask.getStatus())) { countBytesDone += srcChannel.transferTo( countBytesDone, contentSize - countBytesDone, dstChannel ); ioTask.setCountBytesDone(countBytesDone); } return countBytesDone >= contentSize; }
private void invokeCopy( final I fileItem, final O ioTask, final FileChannel srcChannel, final FileChannel dstChannel ) throws IOException { long countBytesDone = ioTask.getCountBytesDone(); final long contentSize = fileItem.size(); if(countBytesDone < contentSize && Status.ACTIVE.equals(ioTask.getStatus())) { countBytesDone += srcChannel.transferTo( countBytesDone, contentSize - countBytesDone, dstChannel ); ioTask.setCountBytesDone(countBytesDone); } if(countBytesDone == contentSize) { finishIoTask(ioTask); } }
static <I extends DataItem, O extends DataIoTask<I>> boolean invokeOverwrite( final I fileItem, final O ioTask, final FileChannel dstChannel ) throws IOException { long countBytesDone = ioTask.getCountBytesDone(); if(countBytesDone == 0) { dstChannel.position(countBytesDone); } final long fileSize = fileItem.size(); if(countBytesDone < fileSize && IoTask.Status.ACTIVE.equals(ioTask.getStatus())) { countBytesDone += fileItem.writeToFileChannel(dstChannel, fileSize - countBytesDone); ioTask.setCountBytesDone(countBytesDone); } return countBytesDone >= fileSize; } }
static <I extends DataItem, O extends DataIoTask<I>> boolean invokeRead( final I fileItem, final O ioTask, final ReadableByteChannel srcChannel ) throws IOException { long countBytesDone = ioTask.getCountBytesDone(); final long contentSize = fileItem.size(); int n; if(countBytesDone < contentSize) { n = srcChannel.read( DirectMemUtil.getThreadLocalReusableBuff(contentSize - countBytesDone) ); if(n < 0) { ioTask.setCountBytesDone(countBytesDone); fileItem.size(countBytesDone); return true; } else { countBytesDone += n; ioTask.setCountBytesDone(countBytesDone); } } return countBytesDone == contentSize; }
static <I extends DataItem, O extends DataIoTask<I>> boolean invokeCreate( final I fileItem, final O ioTask, final FileChannel dstChannel ) throws IOException { long countBytesDone = ioTask.getCountBytesDone(); final long contentSize = fileItem.size(); if(countBytesDone < contentSize && IoTask.Status.ACTIVE.equals(ioTask.getStatus())) { countBytesDone += fileItem.writeToFileChannel(dstChannel, contentSize - countBytesDone); ioTask.setCountBytesDone(countBytesDone); } return countBytesDone >= contentSize; }
private void invokeCreate( final I fileItem, final O ioTask, final FileChannel dstChannel ) throws IOException { long countBytesDone = ioTask.getCountBytesDone(); final long contentSize = fileItem.size(); if(countBytesDone < contentSize && Status.ACTIVE.equals(ioTask.getStatus())) { countBytesDone += fileItem.writeToFileChannel(dstChannel, contentSize - countBytesDone); ioTask.setCountBytesDone(countBytesDone); } if(countBytesDone == contentSize) { finishIoTask(ioTask); } }
private void invokeRead(final I fileItem, final O ioTask, final ReadableByteChannel srcChannel) throws IOException { long countBytesDone = ioTask.getCountBytesDone(); final long contentSize = fileItem.size(); int n; if(countBytesDone < contentSize) { n = srcChannel.read( DirectMemUtil.getThreadLocalReusableBuff(contentSize - countBytesDone) ); if(n < 0) { finishIoTask(ioTask); ioTask.setCountBytesDone(countBytesDone); fileItem.size(countBytesDone); } else { countBytesDone += n; ioTask.setCountBytesDone(countBytesDone); } } if(countBytesDone == contentSize) { finishIoTask(ioTask); } }
long countBytesDone = ioTask.getCountBytesDone(); final long baseItemSize = fileItem.size(); final long rangesSizeSum = ioTask.getMarkedRangesSize();
static <I extends DataItem, O extends DataIoTask<I>> boolean invokeReadAndVerify( final I fileItem, final O ioTask, final ReadableByteChannel srcChannel ) throws DataSizeException, DataCorruptionException, IOException { long countBytesDone = ioTask.getCountBytesDone(); final long contentSize = fileItem.size(); if(countBytesDone < contentSize) {
long countBytesDone = ioTask.getCountBytesDone(); final long baseItemSize = fileItem.size(); final long rangesSizeSum = ioTask.getMarkedRangesSize();
long countBytesDone = ioTask.getCountBytesDone(); final long rangesSizeSum = ioTask.getMarkedRangesSize();
long countBytesDone = ioTask.getCountBytesDone(); final long rangesSizeSum = ioTask.getMarkedRangesSize();
) throws IOException { long countBytesDone = ioTask.getCountBytesDone(); final long baseItemSize = fileItem.size(); final long updatingRangesSize = ioTask.getMarkedRangesSize();
) throws IOException { long countBytesDone = ioTask.getCountBytesDone(); final long baseItemSize = fileItem.size(); final long updatingRangesSize = ioTask.getMarkedRangesSize();
) throws DataSizeException, DataCorruptionException, IOException { long countBytesDone = ioTask.getCountBytesDone(); final long rangesSizeSum = ioTask.getMarkedRangesSize();
) throws DataSizeException, DataCorruptionException, IOException { long countBytesDone = ioTask.getCountBytesDone(); final long rangesSizeSum = ioTask.getMarkedRangesSize();
private void invokeReadAndVerify( final I fileItem, final O ioTask, final ReadableByteChannel srcChannel ) throws DataSizeException, IOException { long countBytesDone = ioTask.getCountBytesDone(); final long contentSize = fileItem.size(); if(countBytesDone < contentSize) {
) throws IOException { long countBytesDone = ioTask.getCountBytesDone(); final long updatingRangesSize = ioTask.getMarkedRangesSize();
final long fixedRangesSizeSum = ioTask.getMarkedRangesSize(); long countBytesDone = ioTask.getCountBytesDone();
) throws IOException { long countBytesDone = ioTask.getCountBytesDone(); final long updatingRangesSize = ioTask.getMarkedRangesSize();