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.everit.jira.hr.admin.util.LocalizedTemplate.java

public LocalizedTemplate(final String baseName, final ClassLoader classLoader) {
    this.baseName = baseName;
    this.classLoader = classLoader;
    try {//from ww w .java2  s.c  o  m
        ParserConfiguration parserConfiguration = new ParserConfiguration(classLoader);
        parserConfiguration.setName(baseName + ".html");
        compiledTemplate = TEMPLATE_COMPILER.compile(
                IOUtils.toString(classLoader.getResource(baseName + ".html"), "UTF8"), parserConfiguration);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}

From source file:org.travis4j.rest.SimpleRestClient.java

public HttpResponse execute(HttpUriRequest request) throws UncheckedIOException {
    try {/*from   w  w w . j  a  v  a2  s  .co  m*/
        LOG.debug("Executing {}", request);
        return httpClient.execute(request);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}

From source file:fr.javatic.mongo.jacksonCodec.JacksonCodec.java

@Override
public void encode(BsonWriter writer, Object value, EncoderContext encoderContext) {
    try {/*from  w ww  .  j  a v  a 2s.c o m*/
        byte[] data = bsonObjectMapper.writeValueAsBytes(value);
        rawBsonDocumentCodec.encode(writer, new RawBsonDocument(data), encoderContext);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}

From source file:onl.area51.httpd.util.PathEntity.java

@Override
public long getContentLength() {
    try {/*from ww  w.  j a  v  a 2s  .com*/
        return Files.size(file);
    } catch (IOException ex) {
        throw new UncheckedIOException(ex);
    }
}

From source file:com.linkedin.gradle.python.tasks.CheckStyleGeneratorTask.java

@Override
public void processResults(ExecResult execResult) {
    final FileStyleViolationsContainer container = new FileStyleViolationsContainer();

    String[] lines = outputStream.toString().split("\\r?\\n");
    for (String line : lines) {
        container.parseLine(line);/*w w w. j  ava  2  s .  c  om*/
    }

    CheckStyleXmlReporter reporter = new CheckStyleXmlReporter(container);
    try {
        FileUtils.write(checkstyleReport, reporter.generateXml());
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}

From source file:com.paolodragone.util.io.datasets.tsv.TsvDataSetWriter.java

private void tryWriteRecord(Object... record) {
    try {//from w w w  . j  av a 2s. co  m
        writeRecord(record);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}

From source file:com.fizzed.blaze.util.Streamables.java

static private Runnable asUncheckedRunnable(Closeable c) {
    return () -> {
        try {/*w ww .  j a v a  2s.co m*/
            c.close();
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    };
}

From source file:net.staticsnow.nexus.repository.apt.internal.hosted.CompressingTempFileStore.java

public Writer openOutput(String key) throws UncheckedIOException {
    try {/*from ww  w.  j av  a 2s. c om*/
        if (holdersByKey.containsKey(key)) {
            throw new IllegalStateException("Output already opened");
        }
        FileHolder holder = new FileHolder();
        holdersByKey.put(key, holder);
        return new OutputStreamWriter(new TeeOutputStream(
                new TeeOutputStream(new GZIPOutputStream(Files.newOutputStream(holder.gzTempFile)),
                        new BZip2CompressorOutputStream(Files.newOutputStream(holder.bzTempFile))),
                Files.newOutputStream(holder.plainTempFile)), Charsets.UTF_8);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}

From source file:org.opencb.commons.datastore.mongodb.GenericDocumentComplexConverter.java

@Override
public T convertToDataModelType(Document document) {
    try {/*from ww  w .j a v  a  2s . c  o  m*/
        restoreDots(document);
        String json = objectMapper.writeValueAsString(document);
        return objectMapper.readValue(json, clazz);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}

From source file:com.github.horrorho.inflatabledonkey.pcs.xfile.FileAssembler.java

static void copy(Path file, List<Chunk> chunkData, Optional<byte[]> key) throws UncheckedIOException {
    try (OutputStream output = Files.newOutputStream(file, CREATE, WRITE, TRUNCATE_EXISTING);
            InputStream input = inputStream(chunkData, key)) {

        IOUtils.copyLarge(input, output);

    } catch (IOException ex) {
        throw new UncheckedIOException(ex);
    }/*  w  w w  .  j a  v  a 2s  .com*/
}