/** * Read a String of known length. * * @param size number of bytes * @return String result * @throws java.io.IOException on io error */ private String readStringFixedLength(int size) throws IOException { return raf.readString(size); }
/** * Read a String of known length. * * @param size number of bytes * @return String result * @throws java.io.IOException on io error */ private String readStringFixedLength(int size) throws IOException { return raf.readString(size); }
void read() throws IOException { datemod = raf.readString(14); if (debug1) { log.debug(" MessageLastModifiedOld={}", datemod); } }
void read() throws IOException { datemod = raf.readString(14); if (debug1) debugOut.println(" MessageLastModifiedOld=" + datemod); }
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; }
public boolean isValidFile( RandomAccessFile raf) throws IOException { try { raf.seek(0); String test = raf.readString(8); return test.equals( Level2VolumeScan.ARCHIVE2) || test.equals( Level2VolumeScan.AR2V0001) || test.equals( Level2VolumeScan.AR2V0003)|| test.equals( Level2VolumeScan.AR2V0004) || test.equals( Level2VolumeScan.AR2V0002) || test.equals( Level2VolumeScan.AR2V0006) || test.equals( Level2VolumeScan.AR2V0007); } catch (IOException ioe) { return false; } }
public boolean isValidFile( RandomAccessFile raf) throws IOException { try { raf.seek(0); String test = raf.readString(8); return test.equals( Level2VolumeScan.ARCHIVE2) || test.equals( Level2VolumeScan.AR2V0001) || test.equals( Level2VolumeScan.AR2V0003)|| test.equals( Level2VolumeScan.AR2V0004) || test.equals( Level2VolumeScan.AR2V0002) || test.equals( Level2VolumeScan.AR2V0006) || test.equals( Level2VolumeScan.AR2V0007); } catch (IOException ioe) { return false; } }
/** * Check if this is a valid file for this IOServiceProvider. * You must make this method thread safe, ie dont keep any state. * * @param raf RandomAccessFile * @return true if valid. * @throws IOException if read error */ public boolean isValidFile(RandomAccessFile raf) throws IOException { raf.seek(0); String test = raf.readString(MAGIC.length()); return test.equals(MAGIC); }
/** * Check if this is a valid file for this IOServiceProvider. * You must make this method thread safe, ie dont keep any state. * * @param raf RandomAccessFile * @return true if valid. * @throws IOException if read error */ public boolean isValidFile(RandomAccessFile raf) throws IOException { raf.seek(0); String test = raf.readString(MAGIC.length()); return test.equals(MAGIC); }
/** * Check if this is a valid file for this IOServiceProvider. * * @param raf RandomAccessFile * @return true if valid. * @throws IOException if read error */ public boolean isValidFile(RandomAccessFile raf) throws IOException { raf.seek(0); int n = MAGIC.length(); if (raf.length() < n) { return false; } String got = raf.readString(n); return (pMAGIC.matcher(got).find() || pMAGIC_OLD.matcher(got).find()); }
static public boolean isValidFile(ucar.unidata.io.RandomAccessFile raf) throws IOException { long filePos = 0; long size = raf.length(); // search forward for the header while ((filePos < size) && (filePos < maxHeaderPos)) { raf.seek(filePos); String magic = raf.readString(8); if (magic.equals(hdf5magic)) return true; filePos = (filePos == 0) ? 512 : 2 * filePos; } return false; }
static boolean isValidFile(ucar.unidata.io.RandomAccessFile raf) throws IOException { long pos = 0; long size = raf.length(); // search forward for the header while ((pos < size) && (pos < maxHeaderPos)) { raf.seek(pos); String magic = raf.readString(4); if (magic.equals(shead)) return true; pos = (pos == 0) ? 512 : 2 * pos; } return false; }
static boolean validatePIB(ucar.unidata.io.RandomAccessFile raf) throws IOException { int pos = 0; raf.seek(pos); // gini header process String pib = raf.readString(GINI_PIB_LEN + GINI_HED_LEN); return findWMOHeader(pib) != 0; }
private String getDataBlockStringValue(RandomAccessFile raf, short offset, int skip, int size) throws IOException { long off = offset + message_offset + MESSAGE_HEADER_SIZE; raf.seek(off); raf.skipBytes(skip); return raf.readString(size); }
private String getDataBlockStringValue(RandomAccessFile raf, short offset, int skip, int size) throws IOException { long off = offset + message_offset + MESSAGE_HEADER_SIZE; raf.seek(off); raf.skipBytes(skip); return raf.readString(size); }
private String getDataBlockStringValue(RandomAccessFile raf, short offset, int skip, int size) throws IOException { long off = offset + message_offset + MESSAGE_HEADER_SIZE; raf.seek(off); raf.skipBytes(skip); return raf.readString(size); }
/** * Check if this is a valid file for this IOServiceProvider. * * @param raf RandomAccessFile * @return true if valid. */ public boolean isValidFile(RandomAccessFile raf) throws IOException { try { raf.order(RandomAccessFile.BIG_ENDIAN); raf.seek(0); raf.skipBytes(4); String test = raf.readString(40); return test.equals(EMISSIONS) || test.equals(AVERAGE) || test.equals(AIRQUALITY) || test.equals(INSTANT); } catch (IOException ioe) { return false; } }
private boolean endFile(RandomAccessFile raf) throws IOException { if (showSkip) System.out.println(" endFile start at " + raf.getFilePointer()); String endRecord = raf.readString(10); // new String(raf.readBytes(10)); while (endRecord.equals("ENDOF FILE")) { endRecord = raf.readString(10); // new String(raf.readBytes(10)); } try { while (raf.read() != (int) 'X') ; //find where X's start while (raf.read() == (int) 'X') ; //skip X's till you run out raf.skipBytes(-1); // go back one readHeader(raf); return true; } catch (EOFException e) { return false; } }
/** * Read a zero terminated String. Leave file positioned after zero terminator byte. * * @param raf from this file * @return String (dont include zero terminator) * @throws java.io.IOException on io error */ private String readString(RandomAccessFile raf) throws IOException { long filePos = raf.getFilePointer(); int count = 0; while (raf.readByte() != 0) count++; raf.seek(filePos); String result = raf.readString(count); raf.readByte(); // skip the zero byte! nn return result; }