public void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws IOException { openDebug(raf, ncfile, null); }
public boolean isValidFile(RandomAccessFile raf) throws IOException { raf.seek(0); if (!readAndTest(raf, NcStream.MAGIC_START)) return false; // must start with these 4 bytes byte[] b = new byte[4]; raf.read(b); return test(b, NcStream.MAGIC_HEADER) || test(b, NcStream.MAGIC_DATA); // immed followed by one of these }
if (!readAndTest(raf, NcStream.MAGIC_START)) { if (ncm != null) { ncm.add(new NcsMess(pos, 0, "MAGIC_START missing - abort")); if (!readAndTest(raf, NcStream.MAGIC_HEADER)) { if (ncm != null) { ncm.add(new NcsMess(pos, 0, "MAGIC_HEADER missing - abort")); int msize = readVInt(raf); byte[] m = new byte[msize]; raf.readFully(m); byte[] b = new byte[4]; raf.readFully(b); if (test(b, NcStream.MAGIC_END)) { if (ncm != null) ncm.add(new NcsMess(pos, 4, "MAGIC_END")); break; if (test(b, NcStream.MAGIC_ERR)) { int esize = readVInt(raf); byte[] dp = new byte[esize]; raf.readFully(dp); if (!test(b, NcStream.MAGIC_DATA)) { if (ncm != null) ncm.add(new NcsMess(pos, 4, "MAGIC_DATA missing - abort")); break; int psize = readVInt(raf); byte[] dp = new byte[psize];
private boolean readAndTest(RandomAccessFile raf, byte[] test) throws IOException { byte[] b = new byte[test.length]; raf.readFully(b); return test(b, test); }
public Array readVlenData(Variable v, Section section, DataStorage dataStorage) throws IOException, InvalidRangeException { raf.seek(dataStorage.filePos); int nelems = readVInt(raf); Object[] result = new Object[nelems]; for (int elem = 0; elem < nelems; elem++) { int dsize = readVInt(raf); byte[] data = new byte[dsize]; raf.readFully(data); Array dataArray = Array.factory(v.getDataType(), null, ByteBuffer.wrap(data)); result[elem] = dataArray; } return new ArrayObject(result[0].getClass(), new int[]{nelems}, result); //return dataArray.section(section.getRanges()); }
return readVlenData(v, section, dataStorage); return readStructureData((Structure) v, section, dataStorage);
if (!readAndTest(raf, NcStream.MAGIC_START)) { if (ncm != null) { ncm.add(new NcsMess(pos, 0, "MAGIC_START missing - abort")); if (!readAndTest(raf, NcStream.MAGIC_HEADER)) { if (ncm != null) { ncm.add(new NcsMess(pos, 0, "MAGIC_HEADER missing - abort")); int msize = readVInt(raf); byte[] m = new byte[msize]; raf.readFully(m); byte[] b = new byte[4]; raf.readFully(b); if (test(b, NcStream.MAGIC_END)) { if (ncm != null) ncm.add(new NcsMess(pos, 4, "MAGIC_END")); break; if (test(b, NcStream.MAGIC_ERR)) { int esize = readVInt(raf); byte[] dp = new byte[esize]; raf.readFully(dp); if (!test(b, NcStream.MAGIC_DATA)) { if (ncm != null) ncm.add(new NcsMess(pos, 4, "MAGIC_DATA missing - abort")); break; int psize = readVInt(raf); byte[] dp = new byte[psize];
private boolean readAndTest(RandomAccessFile raf, byte[] test) throws IOException { byte[] b = new byte[test.length]; raf.read(b); return test(b, test); }
public Array readVlenData(Variable v, Section section, DataStorage dataStorage) throws IOException, InvalidRangeException { raf.seek(dataStorage.filePos); int nelems = readVInt(raf); Object[] result = new Object[nelems]; for (int elem = 0; elem < nelems; elem++) { int dsize = readVInt(raf); byte[] data = new byte[dsize]; raf.read(data); Array dataArray = Array.factory(v.getDataType(), null, ByteBuffer.wrap(data)); result[elem] = dataArray; } return new ArrayObject(result[0].getClass(), new int[]{nelems}, result); //return dataArray.section(section.getRanges()); }
if (!readAndTest(raf, NcStream.MAGIC_START)) { if (ncm != null) { ncm.add(new NcsMess(pos, 0, "MAGIC_START missing - abort")); if (!readAndTest(raf, NcStream.MAGIC_HEADER)) { if (ncm != null) { ncm.add(new NcsMess(pos, 0, "MAGIC_HEADER missing - abort")); int msize = readVInt(raf); byte[] m = new byte[msize]; raf.read(m); byte[] b = new byte[4]; raf.read(b); if (test(b, NcStream.MAGIC_END)) { if (ncm != null) ncm.add(new NcsMess(pos, 4, "MAGIC_END")); break; if (test(b, NcStream.MAGIC_ERR)) { int esize = readVInt(raf); byte[] dp = new byte[esize]; raf.read(dp); if (!test(b, NcStream.MAGIC_DATA)) { if (ncm != null) ncm.add(new NcsMess(pos, 4, "MAGIC_DATA missing - abort")); break; int psize = readVInt(raf); byte[] dp = new byte[psize];
public boolean isValidFile(RandomAccessFile raf) throws IOException { raf.seek(0); if (!readAndTest(raf, NcStream.MAGIC_START)) return false; // must start with these 4 bytes byte[] b = new byte[4]; raf.readFully(b); return test(b, NcStream.MAGIC_HEADER) || test(b, NcStream.MAGIC_DATA); // immed followed by one of these }
private boolean readAndTest(RandomAccessFile raf, byte[] test) throws IOException { byte[] b = new byte[test.length]; raf.readFully(b); return test(b, test); }
public void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws IOException { openDebug(raf, ncfile, null); }
private Array readVlenData(Variable v, Section section, DataStorage dataStorage) throws IOException, InvalidRangeException { raf.seek(dataStorage.filePos); int nelems = readVInt(raf); Array[] result = new Array[nelems]; for (int elem = 0; elem < nelems; elem++) { int dsize = readVInt(raf); byte[] data = new byte[dsize]; raf.readFully(data); Array dataArray = Array.factory(v.getDataType(), (int[]) null, ByteBuffer.wrap(data)); result[elem] = dataArray; } // return Array.makeObjectArray(v.getDataType(), result[0].getClass(), new int[]{nelems}, result); return Array.makeVlenArray(new int[]{nelems}, result); //return dataArray.section(section.getRanges()); }
public boolean isValidFile(RandomAccessFile raf) throws IOException { raf.seek(0); if (!readAndTest(raf, NcStream.MAGIC_START)) return false; // must start with these 4 bytes byte[] b = new byte[4]; raf.readFully(b); return test(b, NcStream.MAGIC_HEADER) || test(b, NcStream.MAGIC_DATA); // immed followed by one of these }
public void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws IOException { super.open(raf, ncfile, cancelTask); openDebug(raf, ncfile, null); }