buffer.limit(oldLimit); record.end = this.toFileOffset(buffer.position()); record.number++;
private void init(boolean strict, GeometryFactory gf) throws IOException, ShapefileException { geometryFactory = gf; if (channel instanceof FileChannel && useMemoryMappedBuffer) { FileChannel fc = (FileChannel) channel; buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()); buffer.position(0); this.currentOffset = 0; } else { // force useMemoryMappedBuffer to false this.useMemoryMappedBuffer = false; // start small buffer = NIOUtilities.allocate(1024); fill(buffer, channel); buffer.flip(); this.currentOffset = 0; } header = new ShapefileHeader(); header.read(buffer, strict); fileShapeType = header.getShapeType(); handler = fileShapeType.getShapeHandler(gf); if (handler == null) { throw new IOException("Unsuported shape type:" + fileShapeType); } headerTransfer = ByteBuffer.allocate(8); headerTransfer.order(ByteOrder.BIG_ENDIAN); // make sure the record end is set now... record.end = this.toFileOffset(buffer.position()); }
record.number = recordNumber; record.end = this.toFileOffset(buffer.position()) + recordLength - 4;
buffer.limit(buffer.capacity()); record.end = this.toFileOffset(buffer.position()); record.number++;
buffer.limit(oldLimit); record.end = this.toFileOffset(buffer.position()); record.number++;
buffer.limit(oldLimit); record.end = this.toFileOffset(buffer.position()); record.number++;
private void init(boolean strict) throws IOException, ShapefileException { header = readHeader(channel, strict); fileShapeType = header.getShapeType(); handler = fileShapeType.getShapeHandler(); // recordHeader = ByteBuffer.allocateDirect(8); // recordHeader.order(ByteOrder.BIG_ENDIAN); if (handler == null) { throw new IOException("Unsuported shape type:" + fileShapeType); } if (channel instanceof FileChannel && useMemoryMappedBuffer) { FileChannel fc = (FileChannel) channel; buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()); buffer.position(100); this.currentOffset = 0; } else { // force useMemoryMappedBuffer to false this.useMemoryMappedBuffer = false; // start with 8K buffer buffer = ByteBuffer.allocateDirect(8 * 1024); fill(buffer, channel); buffer.flip(); this.currentOffset = 100; } headerTransfer = ByteBuffer.allocate(8); headerTransfer.order(ByteOrder.BIG_ENDIAN); // make sure the record end is set now... record.end = this.toFileOffset(buffer.position()); }
private void init(boolean strict, GeometryFactory gf) throws IOException, ShapefileException { geometryFactory = gf; if (channel instanceof FileChannel && useMemoryMappedBuffer) { FileChannel fc = (FileChannel) channel; buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()); buffer.position(0); this.currentOffset = 0; } else { // force useMemoryMappedBuffer to false this.useMemoryMappedBuffer = false; // start small buffer = NIOUtilities.allocate(1024); fill(buffer, channel); buffer.flip(); this.currentOffset = 0; } header = new ShapefileHeader(); header.read(buffer, strict); fileShapeType = header.getShapeType(); handler = fileShapeType.getShapeHandler(gf); if (handler == null) { throw new IOException("Unsuported shape type:" + fileShapeType); } headerTransfer = ByteBuffer.allocate(8); headerTransfer.order(ByteOrder.BIG_ENDIAN); // make sure the record end is set now... record.end = this.toFileOffset(buffer.position()); }
private void init(boolean strict, GeometryFactory gf) throws IOException, ShapefileException { geometryFactory = gf; if (channel instanceof FileChannel && useMemoryMappedBuffer) { FileChannel fc = (FileChannel) channel; buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()); buffer.position(0); this.currentOffset = 0; } else { // force useMemoryMappedBuffer to false this.useMemoryMappedBuffer = false; // start small buffer = NIOUtilities.allocate(1024); fill(buffer, channel); buffer.flip(); this.currentOffset = 0; } header = new ShapefileHeader(); header.read(buffer, strict); fileShapeType = header.getShapeType(); handler = fileShapeType.getShapeHandler(gf); if (handler == null) { throw new IOException("Unsuported shape type:" + fileShapeType); } headerTransfer = ByteBuffer.allocate(8); headerTransfer.order(ByteOrder.BIG_ENDIAN); // make sure the record end is set now... record.end = this.toFileOffset(buffer.position()); }
record.number = recordNumber; record.end = this.toFileOffset(buffer.position()) + recordLength - 4;
record.number = recordNumber; record.end = this.toFileOffset(buffer.position()) + recordLength - 4;
record.number = recordNumber; record.end = this.toFileOffset(buffer.position()) + recordLength - 4;