Skip to content

Commit

Permalink
merge master -Dorg -Snone: PR 21 (Revert PR ome#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
snoopycrimecop committed Jan 3, 2018
2 parents 756baa5 + 5440f56 commit 18535db
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/main/java/loci/common/NIOFileHandle.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ public class NIOFileHandle extends AbstractNIOHandle {
/** The original length of the file. */
private Long defaultLength;

private long effectiveLength;

// -- Constructors --

/**
Expand All @@ -123,7 +121,6 @@ public NIOFileHandle(File file, String mode, int bufferSize)
mapMode = FileChannel.MapMode.READ_WRITE;
}
raf = new RandomAccessFile(file, mode);
effectiveLength = raf.length();
channel = raf.getChannel();
byteBufferProvider = new NIOByteBufferProvider(channel, mapMode);
buffer(position, 0);
Expand Down Expand Up @@ -202,9 +199,8 @@ public int getBufferSize() {
@Override
public void setLength(long length) throws IOException {
if (raf.length() < length) {
raf.setLength(length + getBufferSize());
raf.setLength(length);
}
effectiveLength = length;
raf.seek(length - 1);
buffer = null;
}
Expand All @@ -214,9 +210,6 @@ public void setLength(long length) throws IOException {
/* @see IRandomAccess.close() */
@Override
public void close() throws IOException {
if (isReadWrite && channel.isOpen() && raf.length() != length()) {
raf.setLength(length());
}
raf.close();
}

Expand All @@ -232,7 +225,7 @@ public long length() throws IOException {
if (defaultLength != null) {
return defaultLength;
}
return effectiveLength;
return raf.length();
}

/* @see IRandomAccess.getOrder() */
Expand Down

0 comments on commit 18535db

Please sign in to comment.