< prev index next >

src/jdk.jextract/share/classes/com/sun/tools/jextract/Writer.java

Print this page




  24 package com.sun.tools.jextract;
  25 
  26 import java.io.*;
  27 import java.nio.file.Files;
  28 import java.nio.file.Path;
  29 import java.util.Arrays;
  30 import java.util.Map;
  31 import java.util.Properties;
  32 import java.util.logging.Level;
  33 
  34 public final class Writer {
  35 
  36     private final Log log;
  37     private final Map<String, byte[]> results;
  38 
  39     Writer(Context ctx, Map<String, byte[]> results) {
  40         this.log = ctx.log;
  41         this.results = results;
  42     }
  43 
  44     static final String JEXTRACT_MANIFEST = "META-INF" + File.separatorChar + "jextract.properties";
  45 
  46     public boolean isEmpty() {
  47         return results.isEmpty();
  48     }
  49 
  50     @SuppressWarnings("deprecation")
  51     byte[] getJextractProperties(String[] args) {
  52         Properties props = new Properties();
  53         props.setProperty("os.name", System.getProperty("os.name"));
  54         props.setProperty("os.version", System.getProperty("os.version"));
  55         props.setProperty("os.arch", System.getProperty("os.arch"));
  56         props.setProperty("jextract.args", Arrays.toString(args));
  57         ByteArrayOutputStream baos = new ByteArrayOutputStream();
  58         props.save(baos, "jextract meta data");
  59         return baos.toByteArray();
  60     }
  61 
  62     void writeClassFiles(Path destDir, String[] args) throws IOException {
  63         try {
  64             results.forEach((cls, bytes) -> {




  24 package com.sun.tools.jextract;
  25 
  26 import java.io.*;
  27 import java.nio.file.Files;
  28 import java.nio.file.Path;
  29 import java.util.Arrays;
  30 import java.util.Map;
  31 import java.util.Properties;
  32 import java.util.logging.Level;
  33 
  34 public final class Writer {
  35 
  36     private final Log log;
  37     private final Map<String, byte[]> results;
  38 
  39     Writer(Context ctx, Map<String, byte[]> results) {
  40         this.log = ctx.log;
  41         this.results = results;
  42     }
  43 
  44     static final String JEXTRACT_MANIFEST = "META-INF/jextract.properties";
  45 
  46     public boolean isEmpty() {
  47         return results.isEmpty();
  48     }
  49 
  50     @SuppressWarnings("deprecation")
  51     byte[] getJextractProperties(String[] args) {
  52         Properties props = new Properties();
  53         props.setProperty("os.name", System.getProperty("os.name"));
  54         props.setProperty("os.version", System.getProperty("os.version"));
  55         props.setProperty("os.arch", System.getProperty("os.arch"));
  56         props.setProperty("jextract.args", Arrays.toString(args));
  57         ByteArrayOutputStream baos = new ByteArrayOutputStream();
  58         props.save(baos, "jextract meta data");
  59         return baos.toByteArray();
  60     }
  61 
  62     void writeClassFiles(Path destDir, String[] args) throws IOException {
  63         try {
  64             results.forEach((cls, bytes) -> {


< prev index next >