mirror of https://github.com/apache/lucene.git
fix RAMDirectory(Directory) 2GB size limitation: LUCENE-546
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@408114 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2c5bc593b8
commit
45712c518f
|
@ -69,6 +69,9 @@ Bug fixes
|
|||
14. LUCENE-556: Added empty extractTerms() implementation to MatchAllDocsQuery and
|
||||
ConstantScoreQuery in order to allow their use with a MultiSearcher.
|
||||
(Yonik Seeley)
|
||||
|
||||
15. LUCENE-546: Creating a RAMDirectory from a Directory truncated files over 2GB.
|
||||
(Peter Royal via Yonik Seeley)
|
||||
|
||||
1.9.1
|
||||
|
||||
|
|
|
@ -60,10 +60,10 @@ public final class RAMDirectory extends Directory {
|
|||
// read current file
|
||||
IndexInput is = dir.openInput(files[i]);
|
||||
// and copy to ram disk
|
||||
int len = (int) is.length();
|
||||
int readCount = 0;
|
||||
long len = is.length();
|
||||
long readCount = 0;
|
||||
while (readCount < len) {
|
||||
int toRead = readCount + BufferedIndexOutput.BUFFER_SIZE > len ? len - readCount : BufferedIndexOutput.BUFFER_SIZE;
|
||||
int toRead = readCount + BufferedIndexOutput.BUFFER_SIZE > len ? (int)(len - readCount) : BufferedIndexOutput.BUFFER_SIZE;
|
||||
is.readBytes(buf, 0, toRead);
|
||||
os.writeBytes(buf, toRead);
|
||||
readCount += toRead;
|
||||
|
|
Loading…
Reference in New Issue