List of usage examples for java.io UncheckedIOException UncheckedIOException
public UncheckedIOException(IOException cause)
From source file:org.apache.calcite.adapter.elasticsearch.ElasticsearchTable.java
@Override protected Enumerable<Object> find(String index, List<String> ops, List<Map.Entry<String, Class>> fields) { final String query; if (!ops.isEmpty()) { query = "{" + Util.toString(ops, "", ", ", "") + "}"; } else {//from ww w . j a va 2 s. c o m query = "{}"; } try { ElasticsearchSearchResult result = httpRequest(query); final Function1<ElasticsearchSearchResult.SearchHit, Object> getter = ElasticsearchEnumerators .getter(fields); return Linq4j.asEnumerable(result.searchHits().hits()).select(getter); } catch (IOException e) { throw new UncheckedIOException(e); } }
From source file:com.github.blindpirate.gogradle.util.IOUtils.java
public static void touch(File file) { try {/*w w w . ja v a2 s .c o m*/ org.apache.commons.io.FileUtils.touch(file); } catch (IOException e) { throw new UncheckedIOException(e); } }
From source file:com.github.horrorho.inflatabledonkey.pcs.xfile.FileAssembler.java
static void truncate(Path file, long to) throws UncheckedIOException { // TODO should really limit our written data stream. try {//from w w w . j a v a 2 s . c o m if (to == 0) { return; } long size = Files.size(file); if (size > to) { Files.newByteChannel(file, WRITE).truncate(to).close(); logger.debug("-- truncate() - truncated: {}, {} > {}", file, size, to); } else if (size < to) { logger.warn("-- truncate() - cannot truncate: {}, {} > {}", file, size, to); } } catch (IOException ex) { throw new UncheckedIOException(ex); } }
From source file:edu.umd.umiacs.clip.tools.io.AllFiles.java
public static Stream<File> list(Path dir) { try {/*w w w .ja v a2 s. c om*/ return Files.list(dir).map(Path::toFile); } catch (IOException e) { throw new UncheckedIOException(e); } }
From source file:org.opendatakit.briefcase.reused.UncheckedFiles.java
public static byte[] readAllBytes(Path path) { try {//from w w w . ja v a 2 s .c o m return Files.readAllBytes(path); } catch (IOException e) { throw new UncheckedIOException(e); } }
From source file:org.mitre.mpf.wfm.nodeManager.NodeManagerStatus.java
public void init(boolean reloadConfig) { if (!reloadConfig) { masterNode.setCallback(this); masterNode.run();/*from w ww .ja v a2 s.co m*/ isRunning = true; } try (InputStream inStream = propertiesUtil.getNodeManagerConfigResource().getInputStream()) { if (masterNode.loadConfigFile(inStream, propertiesUtil.getAmqUri())) { if (!reloadConfig && !masterNode.areAllManagersPresent()) { waitForViewUpdate(); } masterNode.launchAllNodes(); } } catch (IOException e) { throw new UncheckedIOException(e); } updateServiceDescriptors(); }
From source file:org.obiba.mica.micaConfig.service.EntityConfigService.java
String mergeSchema(String baseNode, String overrideNode) { try {//w w w . j a v a 2s.c o m return mergeSchema(new ObjectMapper().readTree(baseNode), new ObjectMapper().readTree(overrideNode)) .toString(); } catch (IOException e) { e.printStackTrace(); throw new UncheckedIOException(e); } }
From source file:org.opencb.opencga.storage.hadoop.variant.converters.annotation.HBaseToVariantAnnotationConverter.java
public VariantAnnotation convert(ResultSet resultSet) { int column;//from w ww. j a v a 2 s . co m try { column = resultSet.findColumn(VariantPhoenixHelper.VariantColumn.FULL_ANNOTATION.column()); } catch (SQLException e) { //Column not found return null; } try { String value = resultSet.getString(column); if (StringUtils.isNotEmpty(value)) { try { return objectMapper.readValue(value, VariantAnnotation.class); } catch (IOException e) { throw new UncheckedIOException(e); } } } catch (SQLException e) { // This should never happen! throw new IllegalStateException(e); } return null; }
From source file:jvmoptions.OptionAnalyzer.java
static boolean contains(Path path) { try {/*from w ww.j ava2s. c o m*/ byte[] bytes = Files.readAllBytes(path); String s = new String(bytes); return s.contains("_FLAGS(develop"); } catch (IOException e) { throw new UncheckedIOException(e); } }
From source file:com.github.blindpirate.gogradle.util.IOUtils.java
public static void write(File file, CharSequence data) { try {// www . ja v a 2 s.com org.apache.commons.io.FileUtils.write(file, data, DEFAULT_CHARSET); } catch (IOException e) { throw new UncheckedIOException(e); } }