提交 203902a7 authored 作者: noelgrandin's avatar noelgrandin

The "textMode" field in the FileStore class was from an old feature that got removed, so it can go

上级 c5b9c3e0
...@@ -54,7 +54,6 @@ public class FileStore { ...@@ -54,7 +54,6 @@ public class FileStore {
private boolean checkedWriting = true; private boolean checkedWriting = true;
private final String mode; private final String mode;
private TempFileDeleter tempFileDeleter; private TempFileDeleter tempFileDeleter;
private boolean textMode;
private java.nio.channels.FileLock lock; private java.nio.channels.FileLock lock;
/** /**
...@@ -200,9 +199,6 @@ public class FileStore { ...@@ -200,9 +199,6 @@ public class FileStore {
initKey(salt); initKey(salt);
// read (maybe) encrypted // read (maybe) encrypted
readFully(buff, 0, Constants.FILE_BLOCK_SIZE); readFully(buff, 0, Constants.FILE_BLOCK_SIZE);
if (textMode) {
buff[10] = 'B';
}
if (Utils.compareNotNull(buff, magic) != 0) { if (Utils.compareNotNull(buff, magic) != 0) {
throw DbException.get(ErrorCode.FILE_ENCRYPTION_ERROR_1, name); throw DbException.get(ErrorCode.FILE_ENCRYPTION_ERROR_1, name);
} }
...@@ -471,15 +467,6 @@ public class FileStore { ...@@ -471,15 +467,6 @@ public class FileStore {
} }
} }
/**
* Check if the file store is in text mode.
*
* @return true if it is
*/
public boolean isTextMode() {
return textMode;
}
/** /**
* Try to lock the file. * Try to lock the file.
* *
......
...@@ -91,7 +91,7 @@ public class FileStoreInputStream extends InputStream { ...@@ -91,7 +91,7 @@ public class FileStoreInputStream extends InputStream {
} }
store.readFully(page.getBytes(), 0, Constants.FILE_BLOCK_SIZE); store.readFully(page.getBytes(), 0, Constants.FILE_BLOCK_SIZE);
page.reset(); page.reset();
remainingInBuffer = readInt(); remainingInBuffer = page.readInt();
if (remainingInBuffer < 0) { if (remainingInBuffer < 0) {
close(); close();
return; return;
...@@ -100,18 +100,18 @@ public class FileStoreInputStream extends InputStream { ...@@ -100,18 +100,18 @@ public class FileStoreInputStream extends InputStream {
// get the length to read // get the length to read
if (compress != null) { if (compress != null) {
page.checkCapacity(Data.LENGTH_INT); page.checkCapacity(Data.LENGTH_INT);
readInt(); page.readInt();
} }
page.setPos(page.length() + remainingInBuffer); page.setPos(page.length() + remainingInBuffer);
page.fillAligned(); page.fillAligned();
int len = page.length() - Constants.FILE_BLOCK_SIZE; int len = page.length() - Constants.FILE_BLOCK_SIZE;
page.reset(); page.reset();
readInt(); page.readInt();
store.readFully(page.getBytes(), Constants.FILE_BLOCK_SIZE, len); store.readFully(page.getBytes(), Constants.FILE_BLOCK_SIZE, len);
page.reset(); page.reset();
readInt(); page.readInt();
if (compress != null) { if (compress != null) {
int uncompressed = readInt(); int uncompressed = page.readInt();
byte[] buff = Utils.newBytes(remainingInBuffer); byte[] buff = Utils.newBytes(remainingInBuffer);
page.read(buff, 0, remainingInBuffer); page.read(buff, 0, remainingInBuffer);
page.reset(); page.reset();
...@@ -149,14 +149,4 @@ public class FileStoreInputStream extends InputStream { ...@@ -149,14 +149,4 @@ public class FileStoreInputStream extends InputStream {
return i; return i;
} }
private int readInt() {
if (store.isTextMode()) {
byte[] buff = new byte[8];
page.read(buff, 0, 8);
String s = new String(buff);
return Integer.parseInt(s, 16);
}
return page.readInt();
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论