List of usage examples for org.apache.commons.io FileUtils readFileToString
public static String readFileToString(File file) throws IOException
From source file:com.tek271.reverseProxy.utils.FileTools.java
public static String readTextFileContent(File file) { if (file == null) return ""; String text;/* w w w . j ava 2 s. c om*/ try { text = FileUtils.readFileToString(file); } catch (IOException e) { throw new IllegalArgumentException("Could not read file's text.", e); } return StringUtils.defaultString(text); }
From source file:au.org.ala.delta.ui.codeeditor.TestHarness.java
public TestHarness() throws IOException { super();//from ww w . ja va2 s . c o m this.setSize(new Dimension(400, 400)); CodeTextArea editor = new CodeTextArea("text/confor"); String d = FileUtils.readFileToString(new File("J:/grasses/items")); editor.setText(d); editor.setEOLMarkersPainted(false); editor.setShowLineNumbers(true); JScrollPane scroll = new JScrollPane(editor); this.getContentPane().add(scroll); }
From source file:core.Applicant.java
/** * Constructs an applicant object from file * * @param filepath//www.j av a 2 s.com */ public Applicant(String fileName) { String user = ""; try { user = FileUtils.readFileToString(new File("applicants\\" + fileName + ".asdp")); } catch (Exception e) { } String[] info = user.split("#"); for (int i = 0; i < info.length; i++) { if (info[i].equals("sgName")) { i++; setComp(info[i]); } else if (info[i].equals("pName")) { i++; setName(info[i]); } else if (info[i].equals("pPosition")) { i++; setFunc(info[i]); } else if (info[i].equals("pPhone")) { i++; setTel(info[i]); } else if (info[i].equals("pMail")) { i++; setMail(info[i]); } else if (info[i].equals("pBank")) { i++; setBank(info[i]); } else if (info[i].equals("pKonto")) { i++; setClrnr(info[i].split("THISISADELIMITERTROLOLOLOLOLOL")[0]); setAcnr(info[i].split("THISISADELIMITERTROLOLOLOLOLOL")[1]); } else { } } }
From source file:com.igitras.codegen.common.utils.ReformatterTest.java
@Test public void testFixup() throws Exception { String s = FileUtils.readFileToString(new File( "/Volumes/BACKUP/Mac/SCM/CodeGen/axon-generator/target/TestProject/src/main/java/org/personal/mason/command/HelloCommand.java")); System.out.println(Reformatter.fixup(s)); }
From source file:bear.main.CompiledEntry.java
public String getText() { try {//ww w.jav a 2s . co m return FileUtils.readFileToString(file); } catch (IOException e) { throw Exceptions.runtime(e); } }
From source file:com.mirth.connect.donkey.test.PerformanceTests.java
@BeforeClass final public static void beforeClass() throws Exception { testMessage = FileUtils.readFileToString(new File(TEST_MESSAGE)); Donkey donkey = Donkey.getInstance(); donkey.startEngine(TestUtils.getDonkeyTestConfiguration()); if (daoTimer != null) { donkey.setDaoFactory(new TimedDaoFactory(donkey.getDaoFactory(), daoTimer)); }//from w w w.j a v a 2 s .c o m }
From source file:dremel.common.DremelParserTest.java
@Test public void basic() throws RecognitionException, IOException { //tests parsing all SQL that are encountered in the documentation for (int i = 1; i <= 15; i++) { File tempFile = Drec.getFile("q" + i + "_temp.bql.ast"); File expectedFile = Drec.getFile("q" + i + ".bql.ast"); File queryFile = Drec.getFile("q" + i + ".bql"); FileUtils.writeStringToFile(tempFile, DremelParser.parseBql(FileUtils.readFileToString(queryFile)).toStringTree()); assertTrue("ast files differs", FileUtils.contentEquals(expectedFile, tempFile)); FileUtils.forceDelete(tempFile); }/* w w w.j a va 2 s.c om*/ }
From source file:de.ganskef.shortcircuit.proxy.examples.NettyProxyNettyTest.java
@Test public void testHttpProxy() throws Exception { String url = server.url("/LICENSE.txt"); String direct = FileUtils.readFileToString(getClient().get(url)); String proxied = FileUtils.readFileToString(getClient().get(url, proxy)); assertEquals(direct, proxied);//from w w w .jav a 2s. c om }
From source file:com.jivesoftware.os.routing.bird.endpoints.configuration.MainPropertiesEndpoints.java
@GET @Path("/properties") public Response mainArgs() { try {/*from w ww . j a v a2 s . c om*/ StringBuilder sb = new StringBuilder(); for (String propertyFile : mainProperties.getPropertiesFiles()) { sb.append("//").append(propertyFile); sb.append(FileUtils.readFileToString(new File(propertyFile))); sb.append("\n\n"); } return Response.ok().entity(sb.toString()).type(MediaType.TEXT_PLAIN).build(); } catch (IOException x) { return ResponseHelper.INSTANCE.errorResponse("Failed to load properties.", x); } }
From source file:com.predic8.membrane.examples.tests.CBRTest.java
@Test public void test() throws IOException, InterruptedException { File baseDir = getExampleDir("cbr"); Process2 sl = new Process2.Builder().in(baseDir).script("service-proxy").waitForMembrane().start(); try {// ww w.j av a 2 s .c o m String result = postAndAssert200("http://localhost:2000/shop", FileUtils.readFileToString(new File(baseDir, "order.xml"))); assertContains("Normal order received.", result); result = postAndAssert200("http://localhost:2000/shop", FileUtils.readFileToString(new File(baseDir, "express.xml"))); assertContains("Express order received.", result); result = postAndAssert200("http://localhost:2000/shop", FileUtils.readFileToString(new File(baseDir, "import.xml"))); assertContains("Order contains import items.", result); } finally { sl.killScript(); } }