Search in sources :

Example 1 with ClassWriter

use of org.eclipse.ceylon.langtools.classfile.ClassWriter in project ceylon by eclipse.

the class Java9Util method writeModuleDescriptor.

private static void writeModuleDescriptor(ZipOutputStream zos, Java9ModuleDescriptor module) {
    ClassWriter classWriter = new ClassWriter();
    ClassFile classFile = generateModuleDescriptor(module);
    try {
        zos.putNextEntry(new ZipEntry("module-info.class"));
        classWriter.write(classFile, zos);
        zos.flush();
        zos.closeEntry();
    } catch (IOException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
}
Also used : ClassFile(org.eclipse.ceylon.langtools.classfile.ClassFile) ZipEntry(java.util.zip.ZipEntry) IOException(java.io.IOException) ClassWriter(org.eclipse.ceylon.langtools.classfile.ClassWriter)

Example 2 with ClassWriter

use of org.eclipse.ceylon.langtools.classfile.ClassWriter in project ceylon by eclipse.

the class Java9Util method writeModuleDescriptor.

public static void writeModuleDescriptor(File outputFolder, Java9ModuleDescriptor module) {
    ClassWriter classWriter = new ClassWriter();
    ClassFile classFile = generateModuleDescriptor(module);
    try (OutputStream os = new FileOutputStream(new File(outputFolder, "module-info.class"))) {
        classWriter.write(classFile, os);
    } catch (IOException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
}
Also used : ClassFile(org.eclipse.ceylon.langtools.classfile.ClassFile) ZipOutputStream(java.util.zip.ZipOutputStream) OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) ZipFile(java.util.zip.ZipFile) File(java.io.File) ClassFile(org.eclipse.ceylon.langtools.classfile.ClassFile) ClassWriter(org.eclipse.ceylon.langtools.classfile.ClassWriter)

Aggregations

IOException (java.io.IOException)2 ClassFile (org.eclipse.ceylon.langtools.classfile.ClassFile)2 ClassWriter (org.eclipse.ceylon.langtools.classfile.ClassWriter)2 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 OutputStream (java.io.OutputStream)1 ZipEntry (java.util.zip.ZipEntry)1 ZipFile (java.util.zip.ZipFile)1 ZipOutputStream (java.util.zip.ZipOutputStream)1