Revision 47506 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/csv/virtualrows/RandomAccessFileIndex.java
RandomAccessFileIndex.java | ||
---|---|---|
8 | 8 |
import java.nio.MappedByteBuffer; |
9 | 9 |
import java.nio.channels.FileChannel; |
10 | 10 |
import java.util.AbstractList; |
11 |
import java.util.Iterator; |
|
12 | 11 |
import org.apache.commons.io.IOUtils; |
13 | 12 |
import org.gvsig.tools.util.GetItemWithSize64; |
14 | 13 |
import org.gvsig.tools.util.SetItem; |
... | ... | |
66 | 65 |
this.create(theRaf,sz); |
67 | 66 |
} |
68 | 67 |
|
69 |
public void create(RandomAccessFile raf, long sz) throws IOException {
|
|
68 |
public void create(RandomAccessFile raf, long numElements) throws IOException {
|
|
70 | 69 |
this.raf = raf; |
71 |
this.raf.setLength((sz+HEADER_SIZE)*SIZE_OF_LONG);
|
|
70 |
this.raf.setLength((numElements+HEADER_SIZE)*SIZE_OF_LONG);
|
|
72 | 71 |
this.fileByteBuffer = this.raf.getChannel().map( |
73 | 72 |
FileChannel.MapMode.READ_WRITE, |
74 | 73 |
0, |
... | ... | |
77 | 76 |
this.buffer = this.fileByteBuffer.asLongBuffer(); |
78 | 77 |
this.sz = buffer.limit()-HEADER_SIZE; |
79 | 78 |
} |
79 |
|
|
80 |
public void setNumElements(long numElements) throws IOException { |
|
81 |
long size = ((numElements+HEADER_SIZE)*SIZE_OF_LONG); |
|
82 |
this.fileByteBuffer.force(); |
|
83 |
this.raf.setLength(size); |
|
84 |
this.sz=numElements; |
|
85 |
} |
|
80 | 86 |
|
81 | 87 |
@Override |
82 | 88 |
public void close() throws IOException { |
Also available in: Unified diff