[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems w NetcdfFile.openInMemory

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: Problems w NetcdfFile.openInMemory
  • Date: Mon, 27 Jun 2005 15:50:55 -0700 (PDT)

I'm trying to load netcdf data in an app with no local 'filesystem', such
as a jnlp (web start) environment.  Looks like the best bet, given the
Java Netcdf API, is to locate the data as as resource
(Class.getResourceAsStream). I can thus get the data into a byte[].

But passing that byte[] to NetcdfFile.openInMemory fails with a NPE.
Looking at the latest (2.2.09) sources, it seems that the
InMemoryRandomAccessFile is broken.  The 'buffer' attribute is attached to
the incoming data buf only after a call to 'init(1)' occurs.  The
superclass RandomAccessFile is thus is a bad state, causing an eventual
NPE.

Any help gratefully apprteciated,

Stuart