提交 a566e6a0 authored 作者: Thomas Mueller's avatar Thomas Mueller

Spaces instead of tabs

上级 e5e5a68e
...@@ -422,10 +422,10 @@ class FileDisk extends FileBase { ...@@ -422,10 +422,10 @@ class FileDisk extends FileBase {
@Override @Override
public FileChannel truncate(long newLength) throws IOException { public FileChannel truncate(long newLength) throws IOException {
// compatibility with JDK FileChannel#truncate // compatibility with JDK FileChannel#truncate
if (readOnly) { if (readOnly) {
throw new NonWritableChannelException(); throw new NonWritableChannelException();
} }
if (newLength < file.length()) { if (newLength < file.length()) {
file.setLength(newLength); file.setLength(newLength);
} }
......
...@@ -265,10 +265,10 @@ class FileMem extends FileBase { ...@@ -265,10 +265,10 @@ class FileMem extends FileBase {
@Override @Override
public FileChannel truncate(long newLength) throws IOException { public FileChannel truncate(long newLength) throws IOException {
// compatibility with JDK FileChannel#truncate // compatibility with JDK FileChannel#truncate
if (readOnly) { if (readOnly) {
throw new NonWritableChannelException(); throw new NonWritableChannelException();
} }
if (newLength < size()) { if (newLength < size()) {
data.touch(readOnly); data.touch(readOnly);
pos = Math.min(pos, newLength); pos = Math.min(pos, newLength);
......
...@@ -204,10 +204,10 @@ class FileNioMapped extends FileBase { ...@@ -204,10 +204,10 @@ class FileNioMapped extends FileBase {
@Override @Override
public synchronized FileChannel truncate(long newLength) throws IOException { public synchronized FileChannel truncate(long newLength) throws IOException {
// compatibility with JDK FileChannel#truncate // compatibility with JDK FileChannel#truncate
if (mode == MapMode.READ_ONLY) { if (mode == MapMode.READ_ONLY) {
throw new NonWritableChannelException(); throw new NonWritableChannelException();
} }
if (newLength < size()) { if (newLength < size()) {
setFileLength(newLength); setFileLength(newLength);
} }
......
...@@ -257,10 +257,10 @@ class FileNioMem extends FileBase { ...@@ -257,10 +257,10 @@ class FileNioMem extends FileBase {
@Override @Override
public FileChannel truncate(long newLength) throws IOException { public FileChannel truncate(long newLength) throws IOException {
// compatibility with JDK FileChannel#truncate // compatibility with JDK FileChannel#truncate
if (readOnly) { if (readOnly) {
throw new NonWritableChannelException(); throw new NonWritableChannelException();
} }
if (newLength < size()) { if (newLength < size()) {
data.touch(readOnly); data.touch(readOnly);
pos = Math.min(pos, newLength); pos = Math.min(pos, newLength);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论