mirror of https://github.com/apache/lucene.git
remove 2GB file limitation from RAMIndexInput and RAMIndexOutput: LUCENE-546
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@408916 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
45712c518f
commit
f68744c32b
|
@ -70,8 +70,8 @@ Bug fixes
|
||||||
ConstantScoreQuery in order to allow their use with a MultiSearcher.
|
ConstantScoreQuery in order to allow their use with a MultiSearcher.
|
||||||
(Yonik Seeley)
|
(Yonik Seeley)
|
||||||
|
|
||||||
15. LUCENE-546: Creating a RAMDirectory from a Directory truncated files over 2GB.
|
15. LUCENE-546: Removed 2GB file size limitations for RAMDirectory.
|
||||||
(Peter Royal via Yonik Seeley)
|
(Peter Royal, Michael Chan, Yonik Seeley)
|
||||||
|
|
||||||
1.9.1
|
1.9.1
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ package org.apache.lucene.store;
|
||||||
|
|
||||||
class RAMInputStream extends BufferedIndexInput implements Cloneable {
|
class RAMInputStream extends BufferedIndexInput implements Cloneable {
|
||||||
private RAMFile file;
|
private RAMFile file;
|
||||||
private int pointer = 0;
|
private long pointer = 0;
|
||||||
private long length;
|
private long length;
|
||||||
|
|
||||||
public RAMInputStream(RAMFile f) {
|
public RAMInputStream(RAMFile f) {
|
||||||
|
@ -34,10 +34,10 @@ class RAMInputStream extends BufferedIndexInput implements Cloneable {
|
||||||
|
|
||||||
public void readInternal(byte[] dest, int destOffset, int len) {
|
public void readInternal(byte[] dest, int destOffset, int len) {
|
||||||
int remainder = len;
|
int remainder = len;
|
||||||
int start = pointer;
|
long start = pointer;
|
||||||
while (remainder != 0) {
|
while (remainder != 0) {
|
||||||
int bufferNumber = start/BUFFER_SIZE;
|
int bufferNumber = (int)(start/BUFFER_SIZE);
|
||||||
int bufferOffset = start%BUFFER_SIZE;
|
int bufferOffset = (int)(start%BUFFER_SIZE);
|
||||||
int bytesInBuffer = BUFFER_SIZE - bufferOffset;
|
int bytesInBuffer = BUFFER_SIZE - bufferOffset;
|
||||||
int bytesToCopy = bytesInBuffer >= remainder ? remainder : bytesInBuffer;
|
int bytesToCopy = bytesInBuffer >= remainder ? remainder : bytesInBuffer;
|
||||||
byte[] buffer = (byte[])file.buffers.elementAt(bufferNumber);
|
byte[] buffer = (byte[])file.buffers.elementAt(bufferNumber);
|
||||||
|
@ -53,7 +53,7 @@ class RAMInputStream extends BufferedIndexInput implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void seekInternal(long pos) {
|
public void seekInternal(long pos) {
|
||||||
pointer = (int)pos;
|
pointer = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long length() {
|
public long length() {
|
||||||
|
|
|
@ -26,7 +26,7 @@ import java.io.IOException;
|
||||||
|
|
||||||
public class RAMOutputStream extends BufferedIndexOutput {
|
public class RAMOutputStream extends BufferedIndexOutput {
|
||||||
private RAMFile file;
|
private RAMFile file;
|
||||||
private int pointer = 0;
|
private long pointer = 0;
|
||||||
|
|
||||||
/** Construct an empty output buffer. */
|
/** Construct an empty output buffer. */
|
||||||
public RAMOutputStream() {
|
public RAMOutputStream() {
|
||||||
|
@ -69,8 +69,8 @@ public class RAMOutputStream extends BufferedIndexOutput {
|
||||||
byte[] buffer;
|
byte[] buffer;
|
||||||
int bufferPos = 0;
|
int bufferPos = 0;
|
||||||
while (bufferPos != len) {
|
while (bufferPos != len) {
|
||||||
int bufferNumber = pointer/BUFFER_SIZE;
|
int bufferNumber = (int)(pointer/BUFFER_SIZE);
|
||||||
int bufferOffset = pointer%BUFFER_SIZE;
|
int bufferOffset = (int)(pointer%BUFFER_SIZE);
|
||||||
int bytesInBuffer = BUFFER_SIZE - bufferOffset;
|
int bytesInBuffer = BUFFER_SIZE - bufferOffset;
|
||||||
int remainInSrcBuffer = len - bufferPos;
|
int remainInSrcBuffer = len - bufferPos;
|
||||||
int bytesToCopy = bytesInBuffer >= remainInSrcBuffer ? remainInSrcBuffer : bytesInBuffer;
|
int bytesToCopy = bytesInBuffer >= remainInSrcBuffer ? remainInSrcBuffer : bytesInBuffer;
|
||||||
|
@ -99,7 +99,7 @@ public class RAMOutputStream extends BufferedIndexOutput {
|
||||||
|
|
||||||
public void seek(long pos) throws IOException {
|
public void seek(long pos) throws IOException {
|
||||||
super.seek(pos);
|
super.seek(pos);
|
||||||
pointer = (int)pos;
|
pointer = pos;
|
||||||
}
|
}
|
||||||
public long length() {
|
public long length() {
|
||||||
return file.length;
|
return file.length;
|
||||||
|
|
Loading…
Reference in New Issue