Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.nikolavp.approval.utils;
 
 /*
  * #%L
  * approval
  * %%
  * Copyright (C) 2014 Nikolavp
  * %%
  * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
A default implementation for FileSystemUtils. This one just delegates to methods in java.nio.file.Files. User: nikolavp Date: 27/02/14 Time: 12:26
    private static final Logger LOG  = Logger.getLogger(DefaultFileSystemUtils.class.getName());
    @Override
    public void write(Path pathbyte[] valuethrows IOException {
        Files.write(pathvalue);
    }
    @Override
    public byte[] readFully(Path paththrows IOException {
        return Files.readAllBytes(path);
    }
    @Override
    public void move(Path pathPath filePaththrows IOException {
        if (Files.exists(filePath)) {
            Files.delete(filePath);
        }
        Files.move(pathfilePath);
    }
    @Override
    public void createDirectories(File directorythrows IOException {
        .info("Creating directory " + directory);
        if (!directory.mkdirs()) {
            throw new IOException("Couldn't create directory " + directory);
        }
    }
    @Override
    public void touch(Path pathToCreatethrows IOException {
        Files.createFile(pathToCreate);
    }
New to GrepCode? Check out our FAQ X