Java 类java.io.UncheckedIOException 实例源码

项目:centraldogma    文件:EntryConverter.java   
@Override
protected com.linecorp.centraldogma.common.Entry<?> doBackward(Entry entry) {
    switch (entry.getType()) {
        case JSON:
            try {
                JsonNode value = Jackson.readTree(entry.getContent());
                return com.linecorp.centraldogma.common.Entry.ofJson(entry.getPath(), value);
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        case TEXT:
            return com.linecorp.centraldogma.common.Entry.ofText(entry.getPath(), entry.getContent());
        case DIRECTORY:
            return com.linecorp.centraldogma.common.Entry.ofDirectory(entry.getPath());
        default:
            throw new IllegalArgumentException("unsupported entry type: " + entry.getType());
    }
}
项目:pipeline-github    文件:CommitGroovyObject.java   
@Whitelisted
public CommitStatusGroovyObject createStatus(final String status,
                                             final String context,
                                             final String description,
                                             final String targetUrl) {
    Objects.requireNonNull(status, "status is a required argument");

    CommitStatus commitStatus = new CommitStatus();
    commitStatus.setState(status);
    commitStatus.setContext(context);
    commitStatus.setDescription(description);
    commitStatus.setTargetUrl(targetUrl);
    try {
        return new CommitStatusGroovyObject(
                commitService.createStatus(base, commit.getSha(), commitStatus));
    } catch (final IOException e) {
        throw new UncheckedIOException(e);
    }
}
项目:mpd-2017-i41d    文件:FileRequest.java   
@Override
public Iterable<String> getContent(String path) {
    String[] parts = path.split("/");
    path = parts[parts.length-1]
            .replace('?', '-')
            .replace('&', '-')
            .replace('=', '-')
            .replace(',', '-')
            .substring(0,68);
    try {
        InputStream in = ClassLoader.getSystemResource(path).openStream();
        /*
         * Consumir o Inputstream e adicionar dados ao res
         */
        Iterator<String> iter = new IteratorFromReader(in);
        return () -> iter;
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
项目:moduletools    文件:JITTraceReader.java   
private static Map<String, Set<String>> readClassAsEntry(InputStream input) {
  HashMap<String, Set<String>> map = new HashMap<>(); 
  try {
    ClassReader reader = new ClassReader(input);
    String className = reader.getClassName().replace('/', '.');
    reader.accept(new ClassVisitor(Opcodes.ASM6) {
      @Override
      public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
        String methodName = className + '.' + name;
        map.computeIfAbsent(methodName, __ -> new HashSet<>()).add(methodName + desc);
        return null;
      }
    }, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG);
  } catch(IOException e) {
    throw new UncheckedIOException(e);
  }
  return map;
}
项目:nakadi-producer-spring-boot-starter    文件:EventTransmissionService.java   
public NakadiEvent mapToNakadiEvent(final EventLog event) {
    final NakadiEvent nakadiEvent = new NakadiEvent();

    final NakadiMetadata metadata = new NakadiMetadata();
    metadata.setEid(convertToUUID(event.getId()));
    metadata.setOccuredAt(event.getCreated());
    metadata.setFlowId(event.getFlowId());
    nakadiEvent.setMetadata(metadata);

    HashMap<String, Object> payloadDTO;
    try {
        payloadDTO = objectMapper.readValue(event.getEventBodyData(), new TypeReference<LinkedHashMap<String, Object>>() { });
    } catch (IOException e) {
        log.error("An error occurred at JSON deserialization", e);
        throw new UncheckedIOException(e);
    }

    nakadiEvent.setData(payloadDTO);

    return nakadiEvent;
}
项目:openjdk-jdk10    文件:AbstractResourceBundleProvider.java   
/**
 * Returns a {@code ResourceBundle} for the given {@code baseName} and
 * {@code locale}.
 *
 * @implNote
 * The default implementation of this method calls the
 * {@link #toBundleName(String, Locale) toBundleName} method to get the
 * bundle name for the {@code baseName} and {@code locale} and finds the
 * resource bundle of the bundle name local in the module of this provider.
 * It will only search the formats specified when this provider was
 * constructed.
 *
 * @param baseName the base bundle name of the resource bundle, a fully
 *                 qualified class name.
 * @param locale the locale for which the resource bundle should be instantiated
 * @return {@code ResourceBundle} of the given {@code baseName} and
 *         {@code locale}, or {@code null} if no resource bundle is found
 * @throws NullPointerException if {@code baseName} or {@code locale} is
 *         {@code null}
 * @throws UncheckedIOException if any IO exception occurred during resource
 *         bundle loading
 */
@Override
public ResourceBundle getBundle(String baseName, Locale locale) {
    Module module = this.getClass().getModule();
    String bundleName = toBundleName(baseName, locale);
    ResourceBundle bundle = null;

    for (String format : formats) {
        try {
            if (FORMAT_CLASS.equals(format)) {
                bundle = loadResourceBundle(module, bundleName);
            } else if (FORMAT_PROPERTIES.equals(format)) {
                bundle = loadPropertyResourceBundle(module, bundleName);
            }
            if (bundle != null) {
                break;
            }
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }
    return bundle;
}
项目:openjdk-jdk10    文件:Exchange.java   
public void cancel(IOException cause) {
    // If the impl is non null, propagate the exception right away.
    // Otherwise record it so that it can be propagated once the
    // exchange impl has been established.
    ExchangeImpl<?> impl = exchImpl;
    if (impl != null) {
        // propagate the exception to the impl
        impl.cancel(cause);
    } else {
        try {
            // no impl yet. record the exception
            failed = cause;
            // now call checkCancelled to recheck the impl.
            // if the failed state is set and the impl is not null, reset
            // the failed state and propagate the exception to the impl.
            checkCancelled(false);
        } catch (IOException x) {
            // should not happen - we passed 'false' above
            throw new UncheckedIOException(x);
        }
    }
}
项目:influx-jmh-reporter    文件:JMHJsonParserTest.java   
private static String getResourceAsString(final String resourceName)
{
    final StringBuilder stringBuilder = new StringBuilder();
    final InputStream resourceAsStream = ClassLoader.getSystemClassLoader().getResourceAsStream(resourceName);

    try
    {
        int read;
        while ((read = resourceAsStream.read()) != -1)
        {
            final char aByte = (char)read;
            stringBuilder.append(aByte);
        }

    }
    catch (final IOException e)
    {
        throw new UncheckedIOException(e);
    }
    return stringBuilder.toString();
}
项目:Matcher    文件:MappingWriter.java   
@Override
public void acceptClassComment(String srcName, String comment) {
    try {
        switch (format) {
        case TINY:
        case TINY_GZIP:
            writer.write("CLS-CMT\t");
            writer.write(srcName);
            writer.write('\t');
            writer.write(escape(comment));
            writer.write('\n');
            break;
        case SRG:
            // not supported
            break;
        case ENIGMA:
            enigmaState.acceptClassComment(srcName, comment);
            break;
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
项目:openjdk-jdk10    文件:Loader.java   
@Override
public Stream<URL> resources(String name) {
    Objects.requireNonNull(name);
    // ordering not specified
    int characteristics = (Spliterator.NONNULL | Spliterator.IMMUTABLE |
                           Spliterator.SIZED | Spliterator.SUBSIZED);
    Supplier<Spliterator<URL>> supplier = () -> {
        try {
            List<URL> urls = findResourcesAsList(name);
            return Spliterators.spliterator(urls, characteristics);
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    };
    Stream<URL> s1 = StreamSupport.stream(supplier, characteristics, false);
    Stream<URL> s2 = parent.resources(name);
    return Stream.concat(s1, s2);
}
项目:Dayflower-Path-Tracer    文件:CompiledScene.java   
public static CompiledScene read(final Camera camera, final DataInputStream dataInputStream) {
    try {
        final String name = dataInputStream.readUTF();

        final float[] boundingVolumeHierarchy = doReadFloatArray(dataInputStream);
        final float[] cameraArray = doReadFloatArray(dataInputStream, camera.getArray());
        final float[] point2s = doReadFloatArray(dataInputStream);
        final float[] point3s = doReadFloatArray(dataInputStream);
        final float[] shapes = doReadFloatArray(dataInputStream);
        final float[] surfaces = doReadFloatArray(dataInputStream);
        final float[] textures = doReadFloatArray(dataInputStream);
        final float[] vector3s = doReadFloatArray(dataInputStream);
        final int[] shapeOffsets = doReadIntArray(dataInputStream);

        return new CompiledScene(boundingVolumeHierarchy, cameraArray, point2s, point3s, shapes, surfaces, textures, vector3s, shapeOffsets, name);
    } catch(final IOException e) {
        throw new UncheckedIOException(e);
    }
}
项目:jdk8u-jdk    文件:StreamTest.java   
private void validateFileSystemLoopException(Path start, Path... causes) {
    try (Stream<Path> s = Files.walk(start, FileVisitOption.FOLLOW_LINKS)) {
        try {
            int count = s.mapToInt(p -> 1).reduce(0, Integer::sum);
            fail("Should got FileSystemLoopException, but got " + count + "elements.");
        } catch (UncheckedIOException uioe) {
            IOException ioe = uioe.getCause();
            if (ioe instanceof FileSystemLoopException) {
                FileSystemLoopException fsle = (FileSystemLoopException) ioe;
                boolean match = false;
                for (Path cause: causes) {
                    if (fsle.getFile().equals(cause.toString())) {
                        match = true;
                        break;
                    }
                }
                assertTrue(match);
            } else {
                fail("Unexpected UncheckedIOException cause " + ioe.toString());
            }
        }
    } catch(IOException ex) {
        fail("Unexpected IOException " + ex);
    }
}
项目:Dayflower-Path-Tracer    文件:CompiledScene.java   
public void write(final DataOutputStream dataOutputStream) {
    try {
        dataOutputStream.writeUTF(this.name);

        doWriteFloatArray(dataOutputStream, this.boundingVolumeHierarchy);
        doWriteFloatArray(dataOutputStream, this.camera);
        doWriteFloatArray(dataOutputStream, this.point2s);
        doWriteFloatArray(dataOutputStream, this.point3s);
        doWriteFloatArray(dataOutputStream, this.shapes);
        doWriteFloatArray(dataOutputStream, this.surfaces);
        doWriteFloatArray(dataOutputStream, this.textures);
        doWriteFloatArray(dataOutputStream, this.vector3s);
        doWriteIntArray(dataOutputStream, this.shapeOffsets);
    } catch(final IOException e) {
        throw new UncheckedIOException(e);
    }
}
项目:openjdk-jdk10    文件:DummyWebSocketServer.java   
private boolean readRequest(SocketChannel channel, StringBuilder request)
        throws IOException
{
    ByteBuffer buffer = ByteBuffer.allocate(512);
    int num = channel.read(buffer);
    if (num == -1) {
        return false;
    }
    CharBuffer decoded;
    buffer.flip();
    try {
        decoded = ISO_8859_1.newDecoder().decode(buffer);
    } catch (CharacterCodingException e) {
        throw new UncheckedIOException(e);
    }
    request.append(decoded);
    return Pattern.compile("\r\n\r\n").matcher(request).find();
}
项目:carnotzet    文件:ResourcesManager.java   
/**
 * Copies the resources from the specified module that affects itself. Resources that affect dependencies of the
 * specified module are not copied.
 */
private void copyOwnResources(List<CarnotzetModule> processedModules, CarnotzetModule module) throws IOException {
    Path expandedJarPath = expandedJars.resolve(module.getName());
    Path resolvedModulePath = resolved.resolve(module.getServiceId());
    if (!resolvedModulePath.toFile().exists() && !resolvedModulePath.toFile().mkdirs()) {
        throw new CarnotzetDefinitionException("Could not create directory " + resolvedModulePath);
    }

    // copy all regular files at the root of the expanded jar (such as carnotzet.properties)
    // copy all directories that do not reconfigure another module from the expanded jar recursively
    Files.find(expandedJarPath, 1, isRegularFile().or(nameMatchesModule(processedModules).negate()))
            .forEach(source -> {
                try {
                    if (Files.isRegularFile(source)) {
                        Files.copy(source, resolvedModulePath.resolve(source.getFileName()), StandardCopyOption.REPLACE_EXISTING);
                    } else if (Files.isDirectory(source)) {
                        FileUtils.copyDirectory(source.toFile(), resolvedModulePath.resolve(source.getFileName()).toFile());
                    }
                }
                catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            });
}
项目:metamodel-membrane    文件:FileBasedDataSourceRegistry.java   
@Override
public DataContext openDataContext(String dataSourceName) throws NoSuchDataSourceException {
    if (Strings.isNullOrEmpty(dataSourceName)) {
        throw new IllegalArgumentException("DataSource name cannot be null or empty");
    }
    final File file = getDataSourceFile(dataSourceName);
    if (!file.exists()) {
        throw new NoSuchDataSourceException(dataSourceName);
    }

    final RestDataSourceDefinition dataSource;
    try {
        dataSource = OBJECT_MAPPER.readValue(file, RestDataSourceDefinition.class);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }

    final DataContextSupplier supplier =
            new DataContextSupplier(dataSourceName, dataSource.toDataContextProperties());
    return supplier.get();
}
项目:app-ms    文件:SwaggerCollator.java   
private void processUris(final Map<String, Path> swagger,
    final Map<String, Model> definitionsMap,
    final Map<String, SecuritySchemeDefinition> securityDefinitionsMap,
    final int i) {

    int j = 0;
    while (env.containsProperty(String.format("swagger[%d].uris[%d].swagger", i, j))) {
        try {
            final URL swaggerUrl = env.getProperty(String.format("swagger[%d].uris[%d].swagger", i, j), URL.class);

            final Swagger remoteSwagger = io.swagger.util.Json.mapper().readerFor(Swagger.class).readValue(swaggerUrl.openConnection().getInputStream());

            processPaths(swagger, definitionsMap, securityDefinitionsMap, remoteSwagger, i, j);
            ++j;
        } catch (final IOException e) {
            throw new UncheckedIOException(e);
        }

    }

}
项目:openjdk-jdk10    文件:HashesTest.java   
private void makeJar(String moduleName, String... options) {
    Path mclasses = mods.resolve(moduleName);
    Path outfile = lib.resolve(moduleName + ".jar");
    List<String> args = new ArrayList<>();
    Stream.concat(Stream.of("--create",
                            "--file=" + outfile.toString()),
                  Arrays.stream(options))
          .forEach(args::add);
    args.add("-C");
    args.add(mclasses.toString());
    args.add(".");

    if (Files.exists(outfile)) {
        try {
            Files.delete(outfile);
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

    int rc = JAR_TOOL.run(System.out, System.out, args.toArray(new String[args.size()]));
    System.out.println("jar " + args.stream().collect(Collectors.joining(" ")));
    if (rc != 0) {
        throw new AssertionError("jar failed: rc = " + rc);
    }
}
项目:openjdk-jdk10    文件:Archive.java   
public static boolean isSameLocation(Archive archive, Archive other) {
    if (archive.path == null || other.path == null)
        return false;

    if (archive.location != null && other.location != null &&
            archive.location.equals(other.location)) {
        return true;
    }

    if (archive.isJrt() || other.isJrt()) {
        return false;
    }

    try {
        return Files.isSameFile(archive.path, other.path);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
项目:openjdk-jdk10    文件:ModulePatcher.java   
/**
 * Creates the ModuleReader to reads resources in a patched module.
 */
PatchedModuleReader(List<Path> patches, ModuleReference mref) {
    List<ResourceFinder> finders = new ArrayList<>();
    boolean initialized = false;
    try {
        for (Path file : patches) {
            if (Files.isRegularFile(file)) {
                finders.add(new JarResourceFinder(file));
            } else {
                finders.add(new ExplodedResourceFinder(file));
            }
        }
        initialized = true;
    } catch (IOException ioe) {
        throw new UncheckedIOException(ioe);
    } finally {
        // close all ResourceFinder in the event of an error
        if (!initialized) closeAll(finders);
    }

    this.finders = finders;
    this.mref = mref;
    this.delegateCodeSourceURL = codeSourceURL(mref);
}
项目:core-ng-demo-project    文件:InputStreamsBenchmark.java   
private static byte[] bytesOldVersion(InputStream stream, int initialCapacity) {
    byte[] bytes = new byte[initialCapacity];
    int position = 0;
    try {
        while (true) {
            int bytesToRead = bytes.length - position;
            int bytesRead = stream.read(bytes, position, bytesToRead);
            if (bytesRead < 0) break;
            position += bytesRead;
            if (position >= bytes.length) {
                byte[] newBytes = new byte[bytes.length * 2];
                System.arraycopy(bytes, 0, newBytes, 0, position);
                bytes = newBytes;
            }
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    byte[] result = new byte[position];
    System.arraycopy(bytes, 0, result, 0, position);
    return result;
}
项目:elasticsearch_my    文件:Script.java   
/**
 * Since inline scripts can accept code rather than just an id, they must also be able
 * to handle template parsing, hence the need for custom parsing code.  Templates can
 * consist of either an {@link String} or a JSON object.  If a JSON object is discovered
 * then the content type option must also be saved as a compiler option.
 */
private void setInline(XContentParser parser) {
    try {
        if (type != null) {
            throwOnlyOneOfType();
        }

        type = ScriptType.INLINE;

        if (parser.currentToken() == Token.START_OBJECT) {
            //this is really for search templates, that need to be converted to json format
            XContentBuilder builder = XContentFactory.jsonBuilder();
            idOrCode = builder.copyCurrentStructure(parser).string();
            options.put(CONTENT_TYPE_OPTION, XContentType.JSON.mediaType());
        } else {
            idOrCode = parser.text();
        }
    } catch (IOException exception) {
        throw new UncheckedIOException(exception);
    }
}
项目:setra    文件:FileDiskRepository.java   
@Scheduled(fixedDelay = 900_000)
private void cleanup() {
    LOG.info("Starting file cleanup Job");

    final Instant now = Instant.now();

    int messageCnt = 0;
    for (final Iterator<Map.Entry<String, SecretFile>> it = files.entrySet().iterator();
         it.hasNext();) {

        final Map.Entry<String, SecretFile> entry = it.next();

        if (now.isAfter(entry.getValue().getExpiration())) {
            try {
                burnFile(entry.getKey());
            } catch (final UncheckedIOException e) {
                LOG.error("Error deleting file {}", entry.getKey(), e);
            }
            it.remove();
            messageCnt++;
        }
    }

    LOG.info("Cleaned up {} files", messageCnt);
}
项目:openjdk-jdk10    文件:SJFM_TestBase.java   
/**
 * Create a zip file containing the contents of the test.src directory.
 *
 * @return a path for the zip file.
 * @throws IOException if there is a problem creating the file
 */
private Path createSourceZip() throws IOException {
    Path testSrc = Paths.get(System.getProperty("test.src"));
    Path testZip = Paths.get("test.zip");
    try (OutputStream os = Files.newOutputStream(testZip)) {
        try (ZipOutputStream zos = new ZipOutputStream(os)) {
            Files.list(testSrc)
                .filter(p -> p.getFileName().toString().endsWith(".java"))
                .forEach(p -> {
                    try {
                        zos.putNextEntry(new ZipEntry(p.getFileName().toString()));
                        zos.write(Files.readAllBytes(p));
                        zos.closeEntry();
                    } catch (IOException ex) {
                        throw new UncheckedIOException(ex);
                    }
                });
        }
    }
    return testZip;
}
项目:openjdk-jdk10    文件:ICUBinary.java   
/**
 * Loads an ICU binary data file and returns it as a ByteBuffer.
 * The buffer contents is normally read-only, but its position etc. can be modified.
 *
 * @param itemPath Relative ICU data item path, for example "root.res" or "coll/ucadata.icu".
 * @return The data as a read-only ByteBuffer.
 */
public static ByteBuffer getRequiredData(String itemPath) {
    final Class<ICUBinary> root = ICUBinary.class;

    try (InputStream is = AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
            public InputStream run() {
                return root.getResourceAsStream(itemPath);
            }
        })) {

        BufferedInputStream b=new BufferedInputStream(is, 4096 /* data buffer size */);
        DataInputStream inputStream = new DataInputStream(b);
        byte[] bb = new byte[120000];
        int n = inputStream.read(bb);
        ByteBuffer bytes = ByteBuffer.wrap(bb, 0, n);
        return bytes;
    }
    catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
项目:setra    文件:AbstractDiskMessageRepository.java   
@Scheduled(fixedDelay = 900_000)
private void cleanup() {
    log.info("Starting message cleanup Job");

    final Instant now = Instant.now();

    int messageCnt = 0;
    for (final Iterator<Map.Entry<String, Instant>> it = messages.entrySet().iterator();
         it.hasNext();) {

        final Map.Entry<String, Instant> entry = it.next();

        if (now.isAfter(entry.getValue())) {
            try {
                delete(entry.getKey());
            } catch (final UncheckedIOException e) {
                log.error("Error deleting file {}", entry.getKey(), e);
            }
            it.remove();
            messageCnt++;
        }
    }

    log.info("Cleaned up {} messages", messageCnt);
}
项目:openjdk-jdk10    文件:StreamTest.java   
private void checkMalformedInputException(Stream<String> s) {
    try {
        List<String> lines = s.collect(Collectors.toList());
        fail("UncheckedIOException expected");
    } catch (UncheckedIOException ex) {
        IOException cause = ex.getCause();
        assertTrue(cause instanceof MalformedInputException,
            "MalformedInputException expected");
    }
}
项目:setra    文件:FileMemoryRepository.java   
@Override
public InputStream getStoredFileInputStream(final String id, final KeyIv key) {
    LOG.info("Get stream for file {}", id);
    try {
        return cryptor.getCryptIn(new ByteArrayInputStream(data.get(id)),
            key);
    } catch (final IOException e) {
        throw new UncheckedIOException(e);
    }
}
项目:multiple-dimension-spread    文件:OptimizeDumpStringColumnBinaryMaker.java   
@Override
public IColumn get(){
  try{
    create();
  }catch( IOException e ){
    throw new UncheckedIOException( e );
  }
  return column;
}
项目:pipeline-github    文件:PullRequestGroovyObject.java   
private void setBase(final String newBase) {
    ExtendedPullRequest edit = new ExtendedPullRequest();
    edit.setNumber(pullRequest.getNumber());
    edit.setBase(new PullRequestMarker().setRef(newBase));
    try {
        pullRequest = pullRequestService.editPullRequest(base, edit);
    } catch (final IOException e) {
        throw new UncheckedIOException(e);
    }
}
项目:Parseux    文件:CsvAsDTOTest.java   
@Test(expected = UncheckedIOException.class)
public void throwExceptionTrailingComma() {
    new CsvAsDTO<>(
        new InputStreamReader(
            new ResourceAsStream("csv/test-trail-comma.csv").stream()
        ),
        CsvTestDTO.class
    ).asDTOs();
}
项目:multiple-dimension-spread    文件:BufferDirectCellManager.java   
@Override
public void setPrimitiveObjectArray(final IExpressionIndex indexList , final int start , final int length , final IMemoryAllocator allocator ){
  int loopEnd = ( start + length );
  if( indexList.size() < loopEnd ){
    loopEnd = indexList.size();
  }
  try{
    int index = 0;
    for( int i = start ; i < loopEnd ; i++,index++ ){
      int targetIndex = indexList.get( i );
      if( indexSize <= targetIndex ){
        break;
      }
      PrimitiveObject obj = dicManager.get( targetIndex );
      if( obj == null ){
        allocator.setNull( index );
      }
      else{
        allocator.setPrimitiveObject( index , obj );
      }
    }
    for( int i = index ; i < length ; i++ ){
      allocator.setNull( i );
    }
  }catch( IOException e ){
    throw new UncheckedIOException( e );
  }
}
项目:openjdk-jdk10    文件:TestDriver.java   
private void copyDirectories(Path source, Path dest) throws IOException {
    if (Files.exists(dest))
        FileUtils.deleteFileTreeWithRetry(dest);
    Files.walk(source, Integer.MAX_VALUE)
            .filter(Files::isRegularFile)
            .forEach(p -> {
                try {
                    Path to = dest.resolve(source.relativize(p));
                    Files.createDirectories(to.getParent());
                    Files.copy(p, to);
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            });
}
项目:openjdk-jdk10    文件:FieldSetAccessibleTest.java   
@Override
public Iterator<String> iterator() {
    try {
        return Files.walk(root)
                .filter(p -> p.getNameCount() > 2)
                .filter(p -> modules.contains(p.getName(1).toString()))
                .map(p -> p.subpath(2, p.getNameCount()))
                .map(p -> p.toString())
                .filter(s -> s.endsWith(".class") && !s.endsWith("module-info.class"))
            .iterator();
    } catch(IOException x) {
        throw new UncheckedIOException("Unable to walk \"/modules\"", x);
    }
}
项目:influx-jmh-reporter    文件:FileReader.java   
String readFile(final String file)
{
    try
    {
        return new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.US_ASCII);
    }
    catch (final IOException e)
    {
        throw new UncheckedIOException(e);
    }
}
项目:multiple-dimension-spread    文件:DumpBooleanColumnBinaryMaker.java   
@Override
public IColumn get(){
  try{
    create();
  }catch( IOException e ){
    throw new UncheckedIOException( e );
  }
  return column;
}
项目:openjdk-jdk10    文件:DefaultImageBuilder.java   
/**
 * chmod ugo+x file
 */
private void setExecutable(Path file) {
    try {
        Set<PosixFilePermission> perms = Files.getPosixFilePermissions(file);
        perms.add(PosixFilePermission.OWNER_EXECUTE);
        perms.add(PosixFilePermission.GROUP_EXECUTE);
        perms.add(PosixFilePermission.OTHERS_EXECUTE);
        Files.setPosixFilePermissions(file, perms);
    } catch (IOException ioe) {
        throw new UncheckedIOException(ioe);
    }
}
项目:aws-sdk-java-v2    文件:ApacheUtils.java   
/**
 * Utility function for creating a new BufferedEntity and wrapping any errors
 * as a SdkClientException.
 *
 * @param entity The HTTP entity to wrap with a buffered HTTP entity.
 * @return A new BufferedHttpEntity wrapping the specified entity.
 */
public static HttpEntity newBufferedHttpEntity(HttpEntity entity) {
    try {
        return new BufferedHttpEntity(entity);
    } catch (IOException e) {
        throw new UncheckedIOException("Unable to create HTTP entity: " + e.getMessage(), e);
    }
}
项目:cactoos    文件:UncheckedProcTest.java   
@Test(expected = UncheckedIOException.class)
public void rethrowsCheckedToUncheckedException() {
    new UncheckedProc<>(
        input -> {
            throw new IOException("intended");
        }
    ).exec(1);
}
项目:catalysts_coding_contest_template    文件:InputReaderImpl.java   
@Override
public String readLine() {
    try {
        return bufferedReader.readLine();
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}