mn.EngineForge.module.general.java Source code

Java tutorial

Introduction

Here is the source code for mn.EngineForge.module.general.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package mn.EngineForge.module;

import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.json.simple.JSONArray;
import org.json.simple.JSONValue;

/**
 *
 * @author Lupino
 */
public class general {
    // <editor-fold defaultstate="collapsed" desc="Config">
    private final String path = config.path;
    private final Charset charset = config.charset;
    // </editor-fold>

    static private String readFile(String path, Charset encoding) throws IOException {
        byte[] encoded = Files.readAllBytes(Paths.get(path));
        return new String(encoded, encoding);
    }

    public JSONArray decodeJSON() throws IOException {
        String FILE = readFile(this.path, this.charset);
        Object obj = JSONValue.parse(FILE);
        JSONArray data = (JSONArray) obj;
        return data;
    }

    static public String encryptPass(String PASSWORD) {
        //Encyption here ...
        return PASSWORD;
    }

    static public String decryptPass(String PASSWORD) {
        return null;
    }
}