Example usage for org.apache.commons.io FileUtils readFileToString

List of usage examples for org.apache.commons.io FileUtils readFileToString

Introduction

In this page you can find the example usage for org.apache.commons.io FileUtils readFileToString.

Prototype

public static String readFileToString(File file) throws IOException 

Source Link

Document

Reads the contents of a file into a String using the default encoding for the VM.

Usage

From source file:extraction.relationExtraction.impl.OCRelationExtractionSystem.java

private OCRelationExtractionSystem(Database db, persistentWriter pW, String[] relations,
        Map<Document, String> extractionTable, File extractionFolder, ContentExtractor contentExtractor) {
    super(db, pW, relations, extractionTable, extractionFolder, contentExtractor);

    try {/*from ww w .java 2 s. co  m*/
        paramsXML = FileUtils.readFileToString(new File(paramsFile));
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    this.rdfExtractor = new RDFRelationExtractor();

}

From source file:be.fedict.eid.integration.publicws.PublicWebserviceRevocationTest.java

@Test
public void revokeCertificateInvalidDN() throws IOException {
    String contract = FileUtils.readFileToString(new File(getClass()
            .getResource("/xml/CertificateRevocationContractInvalidDNStartDateEndDate.xml").getFile()));
    tryRevokeCertificate(contract, "d8b6a3c9-6961-4113-a14a-e2ac00349068", ResultType.INVALID_MESSAGE);
}

From source file:de.eidottermihi.rpicheck.test.FirmwareTest.java

@Test
public void firmware_old_format() throws IOException, RaspiQueryException {
    String output = FileUtils.readFileToString(
            FileUtils.getFile("src/test/java/de/eidottermihi/rpicheck/test/vcgencmd_version_old.txt"));
    sessionMocker.withCommand("vcgencmd version", new CommandMocker().withResponse(output).mock());
    String firmwareVersion = raspiQuery.queryFirmwareVersion("vcgencmd");
    assertEquals("362371 (release)", firmwareVersion);
}

From source file:com.stormcloud.ide.api.LogController.java

@RequestMapping(value = "/maven", method = RequestMethod.GET)
@ResponseBody//from   ww w.  j a va  2 s.  co m
public String getMavenLog() throws MavenManagerException {

    String contents;

    try {

        contents = FileUtils.readFileToString(
                new File(RemoteUser.get().getSetting(UserSettings.LOG_FOLDER) + "/maven.log"));

    } catch (IOException e) {
        contents = e.getMessage();
    }

    LOG.info("Returning Contents");

    return contents;
}

From source file:de.tsystems.mms.apm.performancesignature.dynatrace.ThreadDumpTest.java

@Test
public void testJenkinsConfiguration() throws Exception {
    FreeStyleProject project = j.createFreeStyleProject();
    project.getBuildersList().add(new PerfSigThreadDump(dynatraceConfigurations.get(0).name,
            "CustomerFrontend_easyTravel_8080", "wum192202"));
    FreeStyleBuild build = j.assertBuildStatusSuccess(project.scheduleBuild2(0));

    String s = FileUtils.readFileToString(build.getLogFile());
    assertTrue(s.contains("successfully created thread dump on"));
}

From source file:dremel.common.DremelParserTest.java

@Test
public void analyzeAttempt() throws RecognitionException, IOException {
    File queryFile = Drec.getFile("q" + 15 + ".bql");
    AstNode select_statement = DremelParser.parseBql(FileUtils.readFileToString(queryFile));
    assertNull(select_statement.parent);
    assertTrue(select_statement.getType() == BqlParser.N_SELECT_STATEMENT);
    assertTrue(select_statement.getChild(0).getType() == BqlParser.N_FROM);
    assertTrue(select_statement.getChild(1).getType() == BqlParser.N_SELECT);
    assertTrue(select_statement.getChild(2).getType() == BqlParser.N_WHERE);
    assertTrue(select_statement.getChild(0).getChild(0).getChild(0).getText().equals("t"));
    assertTrue(select_statement.getChild(0).getChild(0).getChild(0).getType() == BqlParser.ID);

    AstNode node = (AstNode) select_statement.getChild(0).getChild(0).getChild(0);
    int line = select_statement.getChild(0).getChild(0).getChild(0).getLine();
    int index = select_statement.getChild(0).getChild(0).getChild(0).getCharPositionInLine();

    assertTrue(line == 6);//from www .j  a  v  a2s . c  om
    assertTrue(index == 1);

}

From source file:com.ejwa.dinja.opengles.shader.Shader.java

public Shader(int shaderType, File shaderSource) throws IOException {
    this(shaderType, FileUtils.readFileToString(shaderSource));
}

From source file:com.gs.obevo.util.FileUtilsCobra.java

public static String readFileToString(File file) {
    try {// w  w w.j  ava 2s . c o m
        return FileUtils.readFileToString(file);
    } catch (IOException e) {
        throw new IllegalArgumentException(e);
    }
}

From source file:hu.bme.mit.trainbenchmark.benchmark.eclipseocl.queries.EclipseOclQuery.java

public EclipseOclQuery(final EmfDriver driver, final String workspaceDir, final RailwayQuery query)
        throws IOException, ParserException {
    super(query, driver);

    final String oclQueryDefinition = FileUtils.readFileToString(new File(
            workspaceDir + "/trainbenchmark-tool-eclipseocl/src/main/resources/queries/" + query + ".ocl"));

    ocl = OCL.newInstance();//from  w  w w  .j  a v  a 2  s .c om
    final Helper helper = ocl.createOCLHelper();
    helper.setContext(RailwayPackage.eINSTANCE.getRailwayContainer());
    final OCLExpression expression = helper.createQuery(oclQueryDefinition);
    queryEvaluator = ocl.createQuery(expression);
}

From source file:de.lgohlke.sonar.PomSourceImporter.java

@SuppressWarnings("deprecation")
@Override//from www. java2 s.  c o  m
public void analyse(Project module, SensorContext context) {

    pom = getPom(module);
    index.index(pom);
    try {
        String source = FileUtils.readFileToString(project.getFile());
        index.setSource(pom, source);
    } catch (IOException e) {
        e.printStackTrace();
    }
}