import java.io.*;
public class FileManager{
//Tworzenie folderu
public static void UtworzFolder
(String path
)
{
boolean sukces
= (new File(path
)).
mkdirs();
if (!sukces) {
System.
out.
append("Folder już istnieje!\n");
}
else {
System.
out.
append("Folder został utworzony!");
}
}
//Tworzenie pliku
public static void UtworzPlik
(String path
)
{
try {
if (file.createNewFile()){
System.
out.
println("Plik został utworzony!");
}
else {
System.
out.
println("Plik już istnieje!");
}
e.printStackTrace();
}
}
//Sprawdzanie czy plik istnieje
public static boolean SprawdzCzyIstnieje
(String path
)
{
if (f.exists()){
System.
out.
println("Plik istnieje.");
return true;
}
else {
System.
out.
println("Plik nie istnieje.");
return false;
}
}
//Skasowanie pliku
public static void SkasujPlik
(String path
)
{
try{
if (f.delete()){
System.
out.
println("Plik " + f.
getName() + " został skasowany!");
}
else {
System.
out.
println("Operacja kasowania nie powiodła się. Spróbuj ponownie.");
}
e.printStackTrace();
}
}
//Zmiana nazwy pliku
public static void ZmienNazwe
(String oldPath,
String newPath
)
{
if (oldfile.renameTo(newfile)){
System.
out.
println("Udało się zmienić nazwę pliku.");
}
else{
System.
out.
println("Nie udało zmienić się nazwy pliku!");
}
}
//Kopiowanie pliku
{
try {
byte[] buffer = new byte[1024];
int len;
while ((len = inStream.read(buffer)) > 0) {
outStream.write(buffer, 0, len);
}
inStream.close();
outStream.close();
System.
out.
println("Plik został skopiowany.");
e.printStackTrace();
}
}
//
{
while(true)
{
try{
switch (s)
{
case "1":
System.
out.
append("1: Utworzenie folderu\n");
UtworzFolder("c:\\JavaIOTest\\");
break;
}
//TODO Auto-generated catch block e.printStackTrace();
}
}
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}