public static void writeFromFile(NetcdfFile fileIn, String fileOutName) throws IOException, InvalidRangeException {

    try (FileOutputStream stream = new FileOutputStream(fileOutName)) {
      WritableByteChannel channel = stream.getChannel();
      DataOutputStream dout = new DataOutputStream(Channels.newOutputStream(channel));

      N3channelWriter writer = new N3channelWriter(fileIn);
      int numrec = fileIn.getUnlimitedDimension() == null ? 0 : fileIn.getUnlimitedDimension().getLength();

      writer.writeHeader(dout, numrec);
      dout.flush();

      writer.writeDataAll(channel);
    }
  }
public static void writeFromFile(NetcdfFile fileIn, String fileOutName) throws IOException, InvalidRangeException {

    try (FileOutputStream stream = new FileOutputStream(fileOutName)) {
      WritableByteChannel channel = stream.getChannel();
      DataOutputStream dout = new DataOutputStream(Channels.newOutputStream(channel));

      N3channelWriter writer = new N3channelWriter(fileIn);
      int numrec = fileIn.getUnlimitedDimension() == null ? 0 : fileIn.getUnlimitedDimension().getLength();

      writer.writeHeader(dout, numrec);
      dout.flush();

      writer.writeDataAll(channel);
    }
  }
public static void writeFromFile ( NetcdfFile fileIn , String fileOutName ) throws IOException , InvalidRangeException { try ( FileOutputStream stream = new FileOutputStream ( fileOutName ) ) { WritableByteChannel channel = stream . getChannel ( ) ; DataOutputStream dout = new DataOutputStream ( Channels . newOutputStream ( channel ) ) ; N3channelWriter writer = new N3channelWriter ( fileIn ) ; int numrec = fileIn . getUnlimitedDimension ( ) == null ? 0 : fileIn . getUnlimitedDimension ( ) . getLength ( ) ; writer . writeHeader ( dout , numrec ) ; dout . flush ( ) ; writer . writeDataAll ( channel ) ; } }
//////////////////////////////////////
//////////////////////////////////////