Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.io.*;

public class Main {
    public static void writeFully(File file, byte[] data) throws IOException {
        final OutputStream out = new FileOutputStream(file);
        final BufferedOutputStream bos = new BufferedOutputStream(out);
        try {
            bos.write(data);
        } finally {
            bos.flush();
            bos.close();
        }
    }

    public static void close(Closeable closable) {
        if (closable != null) {
            try {
                closable.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}