Example usage for java.io UncheckedIOException UncheckedIOException

List of usage examples for java.io UncheckedIOException UncheckedIOException

Introduction

In this page you can find the example usage for java.io UncheckedIOException UncheckedIOException.

Prototype

public UncheckedIOException(IOException cause) 

Source Link

Document

Constructs an instance of this class.

Usage

From source file:org.ajoberstar.reckon.core.git.GitInventorySupplier.java

private boolean doMergedInto(RevWalk walk, RevCommit base, RevCommit tip) {
    // TODO consider something like JGit's 24 hour clock skew to eliminate candidates
    // you know can't be see RevWalkUtils#findBranchesReachableFrom
    try {/*from   w ww.  j  a  va2  s .  c o m*/
        return walk.isMergedInto(base, tip);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}

From source file:org.codice.ddf.catalog.content.monitor.DurableWebDavFileConsumer.java

private File getDavFile(DavEntry entry) {
    try {//from   w w w .j av a 2 s.  c o m
        return entry.getFile(SardineFactory.begin());
    } catch (IOException e) {
        LOGGER.debug("Failed to get file for dav entry [{}].", entry.getLocation(), e);
        throw new UncheckedIOException(e);
    }
}

From source file:org.apache.geode.distributed.LauncherIntegrationTestCase.java

protected String getLogFilePath() {
    try {/*from  ww  w . j  a  v a  2 s  . c  o m*/
        return getLogFile().getCanonicalPath();
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}

From source file:org.opendatakit.briefcase.reused.UncheckedFiles.java

private static boolean isHidden(Path path) {
    try {/*from w w  w  . ja v a2  s. c o m*/
        return Files.isHidden(path);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}

From source file:com.spotify.scio.util.RemoteFileUtil.java

private Path downloadImpl(URI src) {
    try {/*from  w w  w  . ja v  a 2s  .  c o  m*/
        Path dst = getDestination(src);

        if (src.getScheme() == null || src.getScheme().equals("file")) {
            // Local URI
            Path srcPath = src.getScheme() == null ? Paths.get(src.toString()) : Paths.get(src);
            if (Files.isSymbolicLink(dst) && Files.readSymbolicLink(dst).equals(srcPath)) {
                LOG.info("URI {} already symlink-ed", src);
            } else {
                Files.createSymbolicLink(dst, srcPath);
                LOG.info("Symlink-ed {} to {}", src, dst);
            }
        } else {
            // Remote URI
            long srcSize = getRemoteSize(src);
            boolean shouldDownload = true;
            if (Files.exists(dst)) {
                long dstSize = Files.size(dst);
                if (srcSize == dstSize) {
                    LOG.info("URI {} already downloaded", src);
                    shouldDownload = false;
                } else {
                    LOG.warn("Destination exists with wrong size. {} [{}B] -> {} [{}B]", src, srcSize, dst,
                            dstSize);
                    Files.delete(dst);
                }
            }
            if (shouldDownload) {
                copyToLocal(src, dst);
                LOG.info("Downloaded {} -> {} [{}B]", src, dst, srcSize);
            }
        }

        return dst;
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}

From source file:com.joyent.manta.client.MantaDirectoryListingIterator.java

@Override
public boolean hasNext() {
    if (!finished.get() && nextLine.get() == null) {
        try {/* w ww.  j  av  a  2 s .c om*/
            selectReader();
            return !finished.get();
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    } else {
        return !finished.get();
    }
}

From source file:com.github.blindpirate.gogradle.util.IOUtils.java

public static void clearDirectory(File dir) {
    try {//from www  .ja v  a 2  s  .  c  o m
        if (dir == null || !dir.exists()) {
            return;
        }
        FileUtils.cleanDirectory(dir);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}

From source file:com.joyent.manta.client.multipart.TestMultipartManager.java

@Override
public Stream<MantaMultipartUploadPart> listParts(TestMultipartUpload upload) throws IOException {
    return Stream.of(upload.getPartsPath().list()).map(partNumber -> {
        try {// ww  w  .j  a  v  a 2  s  .  c o m
            File part = new File(upload.getPartsPath() + File.separator + partNumber);
            File partIdFile = new File(part.getPath() + ".id");
            String etag = FileUtils.readFileToString(partIdFile, StandardCharsets.UTF_8);
            return new MantaMultipartUploadPart(Integer.parseInt(partNumber), upload.getPath(), etag);
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    });
}

From source file:nl.knaw.huygens.alexandria.dropwizard.cli.commands.AlexandriaCommand.java

void exportTAGML(final CLIContext context, final TAGStore store, final TAGView tagView, final String fileName,
        final Long docId) {
    TAGDocument document = store.getDocument(docId);
    TAGMLExporter tagmlExporter = new TAGMLExporter(store, tagView);
    String tagml = tagmlExporter.asTAGML(document).replaceAll("\n\\s*\n", "\n").trim();
    try {/*from  w  ww  . ja v  a2  s.  c  o m*/
        final File out = workFilePath(fileName).toFile();
        FileUtils.writeStringToFile(out, tagml, Charsets.UTF_8);
        context.getWatchedFiles().get(fileName).setLastCommit(Instant.now());
    } catch (IOException e) {
        e.printStackTrace();
        throw new UncheckedIOException(e);
    }
}

From source file:org.opendatakit.briefcase.reused.UncheckedFiles.java

public static String readFirstLine(Path path) {
    try (BufferedReader reader = Files.newBufferedReader(path)) {
        return reader.readLine();
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }//from  w ww . j  a v a2 s  . c  om
}