ucar.unidata.io.RandomAccessFile.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中ucar.unidata.io.RandomAccessFile.<init>方法的一些代码示例,展示了RandomAccessFile.<init>的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RandomAccessFile.<init>方法的具体详情如下:
包路径:ucar.unidata.io.RandomAccessFile
类名称:RandomAccessFile
方法名:<init>

RandomAccessFile.<init>介绍

[英]Constructor, for subclasses
[中]构造函数,用于子类

代码示例

代码示例来源:origin: Unidata/thredds

public FileCacheable open(DatasetUrl durl, int buffer_size, CancelTask cancelTask, Object iospMessage) throws IOException {
  String location = StringUtil2.replace(durl.trueurl, "\\", "/"); // canonicalize the name
  RandomAccessFile result = new RandomAccessFile(location, "r", buffer_size);
  result.cacheState = 1;  // in use
  return result;
 }
};

代码示例来源:origin: Unidata/thredds

public static void main(String[] args) throws IOException {

  String filename = "G:/work/manross/split/872d794d.bufr";
  //String filename = "Q:/cdmUnitTest/formats/bufr/US058MCUS-BUFtdp.SPOUT_00011_buoy_20091101021700.bufr";
  try (RandomAccessFile raf = new RandomAccessFile(filename, "r")) {
   BufrConfig config = BufrConfig.scanEntireFile(raf);
   Formatter out = new Formatter();
   config.show(out);
   System.out.printf("%s%n", out);
  }
 }
}

代码示例来源:origin: Unidata/thredds

static public RandomAccessFile acquire(String location, int buffer_size) throws IOException {
 if (cache == null)
  return new RandomAccessFile(location, "r", buffer_size);
 else
  return (RandomAccessFile) cache.acquire(factory, location, new DatasetUrl(null, location), buffer_size, null, null);
}

代码示例来源:origin: edu.ucar/netcdf

public static void main(String args[]) throws IOException, InstantiationException, IllegalAccessException {
 String fileIn = "/home/yuanho/dorade/swp.1020511015815.SP0L.573.1.2_SUR_v1";
 //String fileIn = "c:/data/image/Dorade/n0r_20041013_1852";
 ucar.nc2.NetcdfFile.registerIOProvider(ucar.nc2.iosp.dorade.Doradeiosp.class);
 ucar.nc2.NetcdfFile ncf = ucar.nc2.NetcdfFile.open(fileIn);
 //List alist = ncf.getGlobalAttributes();
 ucar.unidata.io.RandomAccessFile file = new ucar.unidata.io.RandomAccessFile(fileIn, "r");
 //open1(file, null, null);
 //ucar.nc2.Variable v = ncf.findVariable("BaseReflectivity");
 //ncf.close();
}

代码示例来源:origin: edu.ucar/cdm

public static void main(String args[]) throws IOException {
 NexradStationDB.init();
 RandomAccessFile raf = new RandomAccessFile("R:/testdata/radar/nexrad/Cinrad2/problem/KCCX_20060627_1701", "r");
 new Cinrad2VolumeScan(raf, null);
}

代码示例来源:origin: Unidata/thredds

static public RandomAccessFile acquire(String location) throws IOException {
 if (cache == null)
  return new RandomAccessFile(location, "r");
 else
  return (RandomAccessFile) cache.acquire(factory, new DatasetUrl(null, location));
}

代码示例来源:origin: edu.ucar/netcdf

public static void main(String args[]) throws IOException {
 NexradStationDB.init();
 RandomAccessFile raf = new RandomAccessFile("R:/testdata/radar/nexrad/Cinrad2/problem/KCCX_20060627_1701", "r");
 new Cinrad2VolumeScan(raf, null);
}

代码示例来源:origin: edu.ucar/netcdf

public static void main(String args[]) throws IOException {
 NexradStationDB.init();
 RandomAccessFile raf = new RandomAccessFile("/upc/share/testdata/radar/nexrad/level2/Level2_KFTG_20060818_1814.ar2v.uncompress.missingradials", "r");
 // RandomAccessFile raf = new RandomAccessFile("R:/testdata2/radar/nexrad/level2/problem/KCCX_20060627_1701", "r");
 new Level2VolumeScan(raf, null);
}

代码示例来源:origin: edu.ucar/netcdf

static void testPelim(String filename) throws IOException {
 RandomAccessFile raf = new RandomAccessFile(filename, "r");
 NetcdfFile ncfile = new MyNetcdfFile();
 H4header header = new H4header();
 header.read(raf, ncfile);
 if (showFile) System.out.println(ncfile);
}

代码示例来源:origin: Unidata/thredds

static private TableB readEmbeddedTableB(String location) throws IOException {
 try (RandomAccessFile raf = new RandomAccessFile(location, "r")) {
  MessageScanner scan = new MessageScanner(raf);
  TableLookup lookup = scan.getTableLookup();
  if (lookup != null) {
   return lookup.getLocalTableB();
  }
  return null;
 }
}

代码示例来源:origin: Unidata/thredds

public static void main(String[] args) throws IOException {
  int count = 0;
  RandomAccessFile raf = new RandomAccessFile("Q:/cdmUnitTest/formats/grib1/ECMWF.hybrid.grib1", "r");
  Grib1RecordScanner scan = new Grib1RecordScanner(raf);
  while (scan.hasNext()) {
   scan.next();
   count++;
  }
  raf.close();
  System.out.printf("count=%d%n",count);
 }
}

代码示例来源:origin: edu.ucar/netcdf

private static void dump(String filename) throws IOException {
 System.out.printf("Dump %s%n", filename);
 RandomAccessFile raf = new RandomAccessFile(filename, "r");
 NetcdfFile ncfile = new MyNetcdfFile();
 // its a netcdf-3 file
 raf.order(RandomAccessFile.BIG_ENDIAN);
 N3header headerParser = new N3header();
 headerParser.read(raf, ncfile, new Formatter(System.out));
 raf.close();
}

代码示例来源:origin: Unidata/thredds

static private NetcdfFile open(String filename) throws IOException {
 Ghcnm iosp = new Ghcnm();
 RandomAccessFile raf = new RandomAccessFile(filename, "r");
 NetcdfFile ncfile = new NetcdfFileSubclass(iosp, filename);
 iosp.open(raf, ncfile, null);
 return ncfile;
}

代码示例来源:origin: Unidata/thredds

public static void main(String[] args) throws IOException {
 int count = 0;
 RandomAccessFile raf = new RandomAccessFile("Q:/cdmUnitTest/formats/grib2/LMPEF_CLM_050518_1200.grb", "r");
 System.out.printf("Read %s%n", raf.getLocation());
 Grib2RecordScanner scan = new Grib2RecordScanner(raf);
 while (scan.hasNext()) {
  scan.next();
  count++;
 }
 raf.close();
 System.out.printf("count=%d%n",count);
}

代码示例来源:origin: edu.ucar/netcdf

static private NetcdfFile open(String filename) throws IOException {
 Ghcnm iosp = new Ghcnm();
 RandomAccessFile raf = new RandomAccessFile(filename, "r");
 MyNetcdfFile ncfile = new MyNetcdfFile(iosp);
 iosp.open(raf, ncfile, null);
 return ncfile;
}

代码示例来源:origin: Unidata/thredds

static void testRAF(String filename) throws IOException {
 ucar.unidata.io.RandomAccessFile raf = new ucar.unidata.io.RandomAccessFile(filename, "r");
 int nelems = 37;
 byte[] b = new byte[nelems];
 raf.read(b);
 String line = new String(b, "UTF-8"); // all strings are considered to be UTF-8 unicode.
 System.out.println(line);
 System.out.println(showBytes(b));
 System.out.println(showBytes(line.getBytes(CDM.utf8Charset)));
}

代码示例来源:origin: Unidata/thredds

@Test
public void testSmall() throws IOException {
  try ( RandomAccessFile raf = new RandomAccessFile(
        TestDir.cdmLocalTestDataDir + "hdf4/Level3_GYX_N0R_20151012_1441.nids.invalidhdf4", "r")) {
    assert !H4header.isValidFile(raf);
  } catch (EOFException e) {
    System.out.print(e.getMessage());
    assert false;
  }
}

代码示例来源:origin: Unidata/thredds

private NetcdfFile openJni(String location) throws IOException {
 Nc4Iosp iosp = new Nc4Iosp(NetcdfFileWriter.Version.netcdf4);
 NetcdfFile ncfile = new NetcdfFileSubclass(iosp, location);
 RandomAccessFile raf = new RandomAccessFile(location, "r");
 iosp.open(raf, ncfile, null);
 return ncfile;
}

代码示例来源:origin: Unidata/thredds

private NetcdfFile openJni(String location) throws IOException
{
  Nc4Iosp iosp = new Nc4Iosp(NetcdfFileWriter.Version.netcdf4);
  NetcdfFile ncfile = new NetcdfFileSubclass(iosp, location);
  RandomAccessFile raf = new RandomAccessFile(location, "r");
  iosp.open(raf, ncfile, null);
  return ncfile;
}

代码示例来源:origin: Unidata/thredds

private NetcdfFile openJni(String location) throws IOException {
 Nc4Iosp iosp = new Nc4Iosp(NetcdfFileWriter.Version.netcdf4);
 NetcdfFile ncfile = new NetcdfFileSubclass(iosp, location);
 RandomAccessFile raf = new RandomAccessFile(location, "r");
 iosp.open(raf, ncfile, null);
 return ncfile;
}

相关文章