Package com.google.common.io

Examples of com.google.common.io.ByteSource.copyTo()


            if (!conf.exists()) {
                String resource = stagingDatabase ? "je.properties.staging"
                        : "je.properties.objectdb";
                ByteSource from = Resources.asByteSource((getClass().getResource(resource)));
                try {
                    from.copyTo(Files.asByteSink(conf));
                } catch (IOException e) {
                    Throwables.propagate(e);
                }
            }
View Full Code Here


        } catch (NullPointerException npe) {
            LOGGER.warn("Couldn't obtain default logging configuration file");
            return null;
        }
        try {
            from.copyTo(Files.asByteSink(configFile));
            return configFile.toURI().toURL();
        } catch (Exception e) {
            LOGGER.warn("Error copying logback_default.xml to {}. Using default configuration.",
                    configFile, e);
            return resource;
View Full Code Here

        }
        Random random = new Random();
        for (File file : IMAGE_RESOURCES) {
            int length = random.nextInt(2 * 1024 * 1024);
            ByteSource byteSource = randomByteSource().slice(0, length);
            byteSource.copyTo(Files.asByteSink(file));
        }
    }

    public static boolean isWindowsOs() {
        return System.getProperty("os.name", "").toLowerCase().contains("windows");
View Full Code Here

   public void testMultipartChunkedFileStreamPowerOfTwoSize() throws IOException, InterruptedException {
      final long limit = MultipartUploadStrategy.MAX_BLOCK_SIZE;
      ByteSource input = TestUtils.randomByteSource().slice(0, limit);
      File file = new File("target/const.txt");
      input.copyTo(Files.asByteSink(file));
      String containerName = getContainerName();

      try {
         BlobStore blobStore = view.getBlobStore();
         blobStore.createContainerInLocation(null, containerName);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.