Java RandomAccessFile Create getRandomAccessFile(String path, String charEncoding)

Here you can find the source of getRandomAccessFile(String path, String charEncoding)

Description

get Random Access File

License

Apache License

Declaration

public static RandomAccessFile getRandomAccessFile(String path, String charEncoding)
            throws FileNotFoundException 

Method Source Code


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

import java.io.*;

public class Main {
    public static RandomAccessFile getRandomAccessFile(String path, String charEncoding)
            throws FileNotFoundException {
        InputStream is = getInputStream(path);
        if (is != null) {
            return new RandomAccessFile(new File(path), "r");
        }//from  w  ww . j av a 2  s.  c  o m
        return null;
    }

    public static InputStream getInputStream(String path) {
        try {
            return new FileInputStream(path);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. getRandomAccessFile()