public long getPos() throws IOException { if (raf != null) { return raf.getFilePointer(); } else { return dataPos; } }
public long getPos() throws IOException { if (raf != null) { return raf.getFilePointer(); } else { return dataPos; } }
@Override public boolean hasNext() throws IOException { if (!exists) return false; if (timeSeriesRaf == null) init(); return (timeSeriesRaf.getFilePointer() < totalBytes); // && (recno < 10); LOOK not perfect, eg trailing blanks }
@Override public boolean hasNext() throws IOException { if (!exists) return false; if (timeSeriesRaf == null) init(); return (timeSeriesRaf.getFilePointer() < totalBytes); // && (recno < 10); LOOK not perfect, eg trailing blanks }
public long skipBytes(long n) throws IOException { seek(getFilePointer() + n); return n; }
public long skipBytes(long n) throws IOException { seek(getFilePointer() + n); return n; }
private boolean endRecord(RandomAccessFile raf) throws IOException { if (showSkip) System.out.print(" endRecord start at " + raf.getFilePointer()); int skipped = 0; String endRecord = new String(raf.readBytes(10)); while (endRecord.equals("END RECORD")) { endRecord = new String(raf.readBytes(10)); skipped++; } if (showSkip) System.out.println(" last 10 chars= " + endRecord + " skipped= " + skipped); return true; }
private boolean endRecord(RandomAccessFile raf) throws IOException { if (showSkip) System.out.print(" endRecord start at " + raf.getFilePointer()); int skipped = 0; String endRecord = raf.readString(10); // new String(raf.readBytes(10), CDM.utf8Charset); while (endRecord.equals("END RECORD")) { endRecord = raf.readString(10); // new String(raf.readBytes(10)); skipped++; } if (showSkip) System.out.println(" last 10 chars= " + endRecord + " skipped= " + skipped); return true; }
private boolean endRecord(RandomAccessFile raf) throws IOException { if (showSkip) System.out.print(" endRecord start at " + raf.getFilePointer()); int skipped = 0; String endRecord = raf.readString(10); // new String(raf.readBytes(10), CDM.utf8Charset); while (endRecord.equals("END RECORD")) { endRecord = raf.readString(10); // new String(raf.readBytes(10)); skipped++; } if (showSkip) System.out.println(" last 10 chars= " + endRecord + " skipped= " + skipped); return true; }
private void skip(int nbytes) throws IOException { int pad = padding(nbytes); if (pad > 0) raf.seek(raf.getFilePointer() + pad); }
/** * Constructs a <tt>BufrIndicatorSection</tt> object from a raf. * * @param raf RandomAccessFile with IndicatorSection content * @throws IOException on read error */ public BufrIndicatorSection(RandomAccessFile raf) throws IOException { this.startPos = raf.getFilePointer() - 4; // start of BUFR message, including "BUFR" bufrLength = BufrNumbers.uint3(raf); edition = raf.read(); }
public Grib1SectionBitMap(RandomAccessFile raf) throws IOException { startingPosition = raf.getFilePointer(); // octets 1-3 (Length of section) int length = GribNumbers.int3(raf); raf.seek(startingPosition + length); }
/** * Constructs a <tt>BufrIndicatorSection</tt> object from a raf. * * @param raf RandomAccessFile with IndicatorSection content * @throws IOException on read error */ public BufrIndicatorSection(RandomAccessFile raf) throws IOException { this.startPos = raf.getFilePointer() - 4; // start of BUFR message, including "BUFR" bufrLength = BufrNumbers.uint3(raf); edition = raf.read(); //length = 8; }
private void skip(int nbytes) throws IOException { int pad = padding(nbytes); if (pad > 0) raf.seek(raf.getFilePointer() + pad); }
public Grib1SectionBinaryData(RandomAccessFile raf) throws IOException { startingPosition = raf.getFilePointer(); // octets 1-3 (Length of section) length = GribNumbers.uint3(raf); //if (length < 0) // throw new IllegalStateException("GRIB record has bad length, pos = " + startingPosition); raf.seek(startingPosition + length); }
public Grib2SectionData(RandomAccessFile raf) throws IOException { startingPosition = raf.getFilePointer(); // octets 1-4 (Length of section) msgLength = GribNumbers.int4(raf); // octet 5 int section = raf.read(); if (section != 7) throw new IllegalStateException("Not a Grib2SectionData (section 7)"); // skip to end of the data section raf.seek(startingPosition + msgLength); }
public Grib2SectionBitMap(RandomAccessFile raf) throws IOException { startingPosition = raf.getFilePointer(); // octets 1-4 (Length of section) int length = GribNumbers.int4(raf); // octet 5 int section = raf.read(); if (section != 6) throw new IllegalArgumentException("Not a GRIB-2 Bitmap section"); // octet 6 bitMapIndicator = raf.read(); raf.seek(startingPosition + length); }
void read() throws IOException { if (debugPos) debugOut.println(" *MessageAttributeInfo start pos= " + raf.getFilePointer()); byte version = raf.readByte(); byte flags = raf.readByte(); if ((flags & 1) != 0) maxCreationIndex = raf.readShort(); fractalHeapAddress = readOffset(); v2BtreeAddress = readOffset(); if ((flags & 2) != 0) v2BtreeAddressCreationOrder = readOffset(); if (debug1) debugOut.println(" MessageAttributeInfo version= " + version + " flags = " + flags + this); } }
void dump(String head, long filePos, int nbytes, boolean count) throws IOException { long savePos = raf.getFilePointer(); if (filePos >= 0) raf.seek(filePos); byte[] mess = new byte[nbytes]; raf.readFully(mess); printBytes(head, mess, nbytes, false, debugOut); raf.seek(savePos); }
void dump(String head, long filePos, int nbytes, boolean count) throws IOException { long savePos = raf.getFilePointer(); if (filePos >= 0) raf.seek(filePos); byte[] mess = new byte[nbytes]; raf.read(mess); printBytes(head, mess, nbytes, false, debugOut); raf.seek(savePos); }