Search in sources :

Example 46 with LineNumberReader

use of java.io.LineNumberReader in project gephi by gephi.

the class ImporterCSV method execute.

@Override
public boolean execute(ContainerLoader container) {
    this.container = container;
    this.report = new Report();
    LineNumberReader lineReader = ImportUtils.getTextReader(reader);
    try {
        importData(lineReader);
    } catch (Exception e) {
        throw new RuntimeException(e);
    } finally {
        try {
            lineReader.close();
        } catch (IOException ex) {
        }
    }
    return !cancel;
}
Also used : Report(org.gephi.io.importer.api.Report) IOException(java.io.IOException) IOException(java.io.IOException) LineNumberReader(java.io.LineNumberReader)

Example 47 with LineNumberReader

use of java.io.LineNumberReader in project gephi by gephi.

the class ImporterDL method execute.

@Override
public boolean execute(ContainerLoader container) {
    this.container = container;
    this.report = new Report();
    LineNumberReader lineReader = ImportUtils.getTextReader(reader);
    try {
        importData(lineReader);
    } catch (Exception e) {
        throw new RuntimeException(e);
    } finally {
        try {
            lineReader.close();
        } catch (IOException ex) {
        }
    }
    return !cancel;
}
Also used : Report(org.gephi.io.importer.api.Report) IOException(java.io.IOException) IOException(java.io.IOException) LineNumberReader(java.io.LineNumberReader)

Example 48 with LineNumberReader

use of java.io.LineNumberReader in project gephi by gephi.

the class ImporterVNA method execute.

@Override
public boolean execute(ContainerLoader container) {
    this.container = container;
    this.report = new Report();
    LineNumberReader lineReader = ImportUtils.getTextReader(reader);
    try {
        importData(lineReader);
    } catch (Exception e) {
        report.logIssue(new Issue(e, Issue.Level.SEVERE));
    } finally {
        try {
            lineReader.close();
        } catch (IOException ex) {
        }
    }
    return !cancel;
}
Also used : Issue(org.gephi.io.importer.api.Issue) Report(org.gephi.io.importer.api.Report) IOException(java.io.IOException) IOException(java.io.IOException) LineNumberReader(java.io.LineNumberReader)

Example 49 with LineNumberReader

use of java.io.LineNumberReader in project gephi by gephi.

the class PaletteManager method loadPalettes.

private static Collection<Palette> loadPalettes(String fileName) throws IOException {
    LineNumberReader reader = new LineNumberReader(new InputStreamReader(PaletteManager.class.getResourceAsStream(fileName)));
    String line;
    List<List<Color>> palettes = new ArrayList<>();
    while ((line = reader.readLine()) != null) {
        List<Color> palette = new ArrayList<>();
        String[] split = line.split(",");
        for (String colorStr : split) {
            if (!colorStr.isEmpty()) {
                palette.add(parseHexColor(colorStr.trim()));
            }
        }
        if (!palette.isEmpty()) {
            palettes.add(palette);
        }
    }
    List<Palette> result = new ArrayList<>();
    for (List<Color> cls : palettes) {
        Palette plt = new Palette(cls.toArray(new Color[0]));
        result.add(plt);
    }
    return result;
}
Also used : InputStreamReader(java.io.InputStreamReader) Color(java.awt.Color) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) LinkedList(java.util.LinkedList) LineNumberReader(java.io.LineNumberReader)

Example 50 with LineNumberReader

use of java.io.LineNumberReader in project camel by apache.

the class OrderTest method checkWsdl.

public void checkWsdl(InputStream in) throws Exception {
    boolean containsOrderComplexType = false;
    LineNumberReader reader = new LineNumberReader(new InputStreamReader(in));
    String line;
    while ((line = reader.readLine()) != null) {
        if (line.contains("complexType name=\"order\"")) {
            containsOrderComplexType = true;
        // break;
        }
    }
    if (!containsOrderComplexType) {
        throw new RuntimeException("WSDL does not contain complex type defintion for class Order");
    }
}
Also used : InputStreamReader(java.io.InputStreamReader) LineNumberReader(java.io.LineNumberReader)

Aggregations

LineNumberReader (java.io.LineNumberReader)401 IOException (java.io.IOException)203 InputStreamReader (java.io.InputStreamReader)167 FileReader (java.io.FileReader)102 File (java.io.File)79 InputStream (java.io.InputStream)64 StringReader (java.io.StringReader)64 ArrayList (java.util.ArrayList)54 FileInputStream (java.io.FileInputStream)33 BufferedReader (java.io.BufferedReader)27 PrintWriter (java.io.PrintWriter)25 HashMap (java.util.HashMap)22 FileNotFoundException (java.io.FileNotFoundException)20 BufferedWriter (java.io.BufferedWriter)16 FileWriter (java.io.FileWriter)16 Pattern (java.util.regex.Pattern)16 Test (org.junit.jupiter.api.Test)16 ByteArrayInputStream (java.io.ByteArrayInputStream)15 ByteArrayOutputStream (java.io.ByteArrayOutputStream)15 Reader (java.io.Reader)14