@Test public void testGetBody() throws Exception { final ProjectFile projectFile = new ProjectFile(); final Project project = new Project(randomUUID().toString(), projectFile); final Source source = new Source(project, randomUUID().toString()); source.setContentProvider(() -> openWithExtensionAs("lua")); assertFalse(source.getBody().get().trim().isEmpty()); }
public Text getBody() { return new Text(() -> { final BodyCollector collector = new BodyCollector(); try (final BufferedReader sourceIn = open()) { String line = null; while (null != (line = sourceIn.readLine())) { logger.trace("Line: {}", line); collector.add(line); } return new ByteArrayInputStream(collector.toString().getBytes()); } }); }
Source extends File { public Text getBody() { return new Text(() -> { final BodyCollector collector = new BodyCollector(); try (final BufferedReader sourceIn = open()) { String line = null; while (null != (line = sourceIn.readLine())) { logger.trace("Line: {}", line); collector.add(line); } return new ByteArrayInputStream(collector.toString().getBytes()); } }); } }
Source extends File { public Text getBody() { return new Text(() -> { final BodyCollector collector = new BodyCollector(); try (final BufferedReader sourceIn = open()) { String line = null; while (null != (line = sourceIn.readLine())) { logger.trace("Line: {}", line); collector.add(line); } return new ByteArrayInputStream(collector.toString().getBytes()); } }); } Source(final Project project, final String location); }
Source extends File { public Text getBody() { return new Text(() -> { final BodyCollector collector = new BodyCollector(); try (final BufferedReader sourceIn = open()) { String line = null; while (null != (line = sourceIn.readLine())) { logger.trace("Line: {}", line); collector.add(line); } return new ByteArrayInputStream(collector.toString().getBytes()); } }); } Source(final Project project, final String location); @Override List<Resource> getDependencies(final ResourceManager resourceManager); List<String> readImports(); Text getBody(); @Override int hashCode(); @Override boolean equals(Object obj); }
Source extends File { public Text getBody() { return new Text(() -> { final BodyCollector collector = new BodyCollector(); try (final BufferedReader sourceIn = open()) { String line = null; while (null != (line = sourceIn.readLine())) { logger.trace("Line: {}", line); collector.add(line); } return new ByteArrayInputStream(collector.toString().getBytes()); } }); } Source(final Project project, final String location); @Override List<Resource> getDependencies(final ResourceManager resourceManager); List<String> readImports(); Text getBody(); @Override int hashCode(); @Override boolean equals(Object obj);  }