All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.citahub.cita.utils.Files Maven / Gradle / Ivy

The newest version!
package com.citahub.cita.utils;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

/**
 * File utility functions.
 */
public class Files {

    private Files() { }

    public static byte[] readBytes(File file) throws IOException {
        byte[] bytes = new byte[(int) file.length()];
        FileInputStream fileInputStream = new FileInputStream(file);
        fileInputStream.read(bytes);
        fileInputStream.close();
        return bytes;
    }

    public static String readString(File file) throws IOException {
        return new String(readBytes(file));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy