public static void makeGzippedCSVFile(ByteBuffer onePinData,Path path) throws IOException {
  try (OutputStream output=Files.newOutputStream(path);Writer writer=new OutputStreamWriter(new GZIPOutputStream(output),"UTF-8")){
    while (onePinData.remaining() > 0) {
      double value=onePinData.getDouble();
      long ts=onePinData.getLong();
      writer.write(String.valueOf(value));
      writer.write(',');
      writer.write(String.valueOf(ts));
      writer.write('\n');
    }
  }
 }

public static void makeGzippedCSVFile ( ByteBuffer onePinData , Path path ) throws IOException { try ( OutputStream output = Files . newOutputStream ( path ) ; Writer writer = new OutputStreamWriter ( new GZIPOutputStream ( output ) , "UTF-8" ) ) { while ( onePinData . remaining ( ) > 0 ) { double value = onePinData . getDouble ( ) ; long ts = onePinData . getLong ( ) ; writer . write ( String . valueOf ( value ) ) ; writer . write ( ',' ) ; writer . write ( String . valueOf ( ts ) ) ; writer . write ( '\n' ) ; } } }
writes bytebuffer with value ( double 8 bytes ) , timestamp ( long 8 bytes ) data to disk as csv file and gzips it .
