// Read raw data.
Package.File readFile(String fname, InputStream in) throws IOException {
Package.File file = pkg.new File(fname);
file.readFrom(in);
if (file.isDirectory() && file.getFileLength() != 0)
throw new IllegalArgumentException("Non-empty directory: "+file.getFileName());
return file;
}