Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;

import java.io.IOException;
import java.io.RandomAccessFile;

public class Main {
    public static byte[] readFilename(String filename) throws IOException {
        return readFile(new File(filename));
    }

    public static byte[] readFile(File f1) throws IOException {
        RandomAccessFile f = new RandomAccessFile(f1, "r");
        byte[] b = new byte[(int) f.length()];
        f.read(b);
        f.close();
        return b;
    }
}