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.FileInputStream;
import java.io.FileNotFoundException;

import java.io.IOException;

import java.util.ArrayList;

public class Main {
    public static String[] GetSupportedFileSystems() {
        try {
            FileInputStream fProcFS = new FileInputStream(new File("/proc/filesystems"));
            ArrayList<String> filesystems = new ArrayList<String>();
            byte[] data1 = new byte[1024];
            int len = fProcFS.read(data1);
            fProcFS.close();
            String fs = new String(data1, 0, len);
            if (fs.contains("rfs"))
                filesystems.add("rfs");
            if (fs.contains("jfs"))
                filesystems.add("jfs");
            if (fs.contains("ext2"))
                filesystems.add("ext2");
            if (fs.contains("ext3"))
                filesystems.add("ext3");
            if (fs.contains("ext4"))
                filesystems.add("ext4");
            String[] List = (String[]) filesystems.toArray(new String[filesystems.size()]);
            return List;
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}