Search in sources :

Example 1 with NullOutputStream

use of net.sourceforge.plantuml.NullOutputStream in project plantuml-server by plantuml.

the class DiagramResponse method sendCheck.

void sendCheck(String uml) throws IOException {
    response.setContentType(getContentType());
    SourceStringReader reader = new SourceStringReader(uml);
    DiagramDescription desc = reader.outputImage(new NullOutputStream(), new FileFormatOption(FileFormat.PNG, false));
    PrintWriter httpOut = response.getWriter();
    httpOut.print(desc.getDescription());
}
Also used : FileFormatOption(net.sourceforge.plantuml.FileFormatOption) SourceStringReader(net.sourceforge.plantuml.SourceStringReader) DiagramDescription(net.sourceforge.plantuml.core.DiagramDescription) NullOutputStream(net.sourceforge.plantuml.NullOutputStream) PrintWriter(java.io.PrintWriter)

Example 2 with NullOutputStream

use of net.sourceforge.plantuml.NullOutputStream in project plantuml-server by plantuml.

the class DiagramResponse method sendMap.

void sendMap(String uml) throws IOException {
    response.setContentType(getContentType());
    SourceStringReader reader = new SourceStringReader(uml);
    final BlockUml blockUml = reader.getBlocks().get(0);
    if (StringUtils.isDiagramCacheable(uml)) {
        addHeaderForCache(blockUml);
    }
    final Diagram diagram = blockUml.getDiagram();
    ImageData map = diagram.exportDiagram(new NullOutputStream(), 0, new FileFormatOption(FileFormat.PNG, false));
    if (map.containsCMapData()) {
        PrintWriter httpOut = response.getWriter();
        final String cmap = map.getCMapData("plantuml");
        httpOut.print(cmap);
    }
}
Also used : FileFormatOption(net.sourceforge.plantuml.FileFormatOption) ImageData(net.sourceforge.plantuml.core.ImageData) SourceStringReader(net.sourceforge.plantuml.SourceStringReader) BlockUml(net.sourceforge.plantuml.BlockUml) Diagram(net.sourceforge.plantuml.core.Diagram) NullOutputStream(net.sourceforge.plantuml.NullOutputStream) PrintWriter(java.io.PrintWriter)

Aggregations

PrintWriter (java.io.PrintWriter)2 FileFormatOption (net.sourceforge.plantuml.FileFormatOption)2 NullOutputStream (net.sourceforge.plantuml.NullOutputStream)2 SourceStringReader (net.sourceforge.plantuml.SourceStringReader)2 BlockUml (net.sourceforge.plantuml.BlockUml)1 Diagram (net.sourceforge.plantuml.core.Diagram)1 DiagramDescription (net.sourceforge.plantuml.core.DiagramDescription)1 ImageData (net.sourceforge.plantuml.core.ImageData)1