Disabled external gits
This commit is contained in:
26
Alpano/tests/ch/epfl/alpano/dem/MemMapExample.java
Normal file
26
Alpano/tests/ch/epfl/alpano/dem/MemMapExample.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package ch.epfl.alpano.dem;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.FileInputStream;
|
||||
import java.nio.ShortBuffer;
|
||||
import java.nio.channels.FileChannel.MapMode;
|
||||
|
||||
public class MemMapExample {
|
||||
public static void main(String[] args)
|
||||
throws IOException {
|
||||
File f = new File("HGT"+File.separatorChar+"N46E007.hgt");
|
||||
long l = f.length();
|
||||
try (FileInputStream s = new FileInputStream(f)) {
|
||||
ShortBuffer b = s.getChannel()
|
||||
.map(MapMode.READ_ONLY, 0, l)
|
||||
.asShortBuffer();
|
||||
|
||||
for (int i = 0; i <= 5; ++i)
|
||||
System.out.println(b.get(i));
|
||||
System.out.println("-----------------");
|
||||
for (int i = 12967195; i < 12967201; ++i)
|
||||
System.out.println(b.get(i));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user