- fixed return value of readBlockAligend

- adjusted loglevel of BlockAlignedWritableFile
[ci skip]
This commit is contained in:
Sebastian Stenzel
2016-02-20 12:34:14 +01:00
parent b85a110a24
commit 3a82dfb23f
2 changed files with 10 additions and 6 deletions

View File

@@ -69,12 +69,16 @@ class BlockAlignedReadableFile implements ReadableFile {
}
private int readBlockAligned(ByteBuffer target) {
int read = -1;
while (!eofReached && target.hasRemaining()) {
read += ByteBuffers.copy(currentBlockBuffer, target);
readCurrentBlockIfNeeded();
if (eofReached) {
return -1;
} else {
int read = 0;
while (!eofReached && target.hasRemaining()) {
read += ByteBuffers.copy(currentBlockBuffer, target);
readCurrentBlockIfNeeded();
}
return read;
}
return read;
}
private void readCurrentBlockIfNeeded() {

View File

@@ -54,7 +54,7 @@ class BlockAlignedWritableFile implements WritableFile {
// visible for testing
void switchToBlockAlignedMode() {
LOG.debug("switching to blockaligend write...");
LOG.trace("switching to blockaligend write...");
mode = Mode.BLOCK_ALIGNED;
}