private void writeServices()

in src/it/jdk16-annotation/src/main/java/com/mycompany/jdk16annotation/ServiceProviderProcessor.java [57:79]


    private void writeServices() {
        try {
            FileObject out = processingEnv
                    .getFiler()
                    .createResource(StandardLocation.CLASS_OUTPUT, "", "META-INF/one", new Element[0]);
            try (OutputStream os = out.openOutputStream()) {
                OutputStream os2 = processingEnv
                        .getFiler()
                        .createSourceFile("org.Milos", new Element[0])
                        .openOutputStream();
                try (OutputStreamWriter osr = new OutputStreamWriter(os2)) {
                    PrintWriter w = new PrintWriter(new OutputStreamWriter(os, "UTF-8"));
                    w.write("test");
                    w.flush();
                    String clazz = "package org;\n class Milos {}";
                    osr.write(clazz.toCharArray());
                    osr.flush();
                }
            }
        } catch (IOException x) {
            processingEnv.getMessager().printMessage(Kind.ERROR, "Failed to write to one: " + x.toString());
        }
    }