package fr.upem.net.buffers;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
import java.nio.charset.Charset;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;

public class LoadWithEncoding {

    private static void usage(){
        System.out.println("Usage: LoadWithEncoding charset [filename]");
    }

    private static String stringFromFile(Charset cs,Path path) throws IOException {
        // TODO	
    }

    private static String stringFromStandardInput(Charset cs) throws IOException {
       // TODO
    }

    public static void main(String[] args) throws IOException {
        if (args.length!=2 && args.length!=1){
            usage();
            return;
        }
        Charset cs=Charset.forName(args[0]);
        if (args.length==2) {
            Path path = Paths.get(args[1]);
            System.out.println(stringFromFile(cs,path));
        }

        if (args.length==1) {
            System.out.println(stringFromStandardInput(cs));
        }
    }


}
