-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileSystem.java
More file actions
77 lines (59 loc) · 1.54 KB
/
FileSystem.java
File metadata and controls
77 lines (59 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
* 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 javapep;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.OutputStream;
/**
*
* @author anil
*/
public class FileSystem {
public static void main(String args[]) throws Exception
{
// String filen = "test.txt";
//FileInputStream fin = new FileInputStream(filen);
FileInputStream f1 = new FileInputStream("D:\\anil.txt");//it stores the data into byte array
// int a;
// while((a=f1.read())!=-1)
// {
// System.out.print((char)a);
//
// }
//byte ba[]=new byte[20];
//f1.read(ba);
//for(byte i:ba)
//{
//System.out.print((char)i);
//}
//FileReader f2=new FileReader("D:\\anil.txt");//it stores the data into char array
//char c[]=new char[20];
//f2.read(c);
//for(char m:c)
//{
//System.out.print((char)m);
//}
//File f4=new File("D:\\anil.txt");
//System.out.println(f4.getName());
//System.out.println(f4.exists());
//System.out.println(f4.getPath());
//System.out.println(f4.canWrite());
//System.out.println(f4.getParent());
//System.out.println(f4.isDirectory());
//System.out.println(f4.canWrite());
//System.out.println(f4.isFile());
File f7=new File("abc");
f7.mkdir();
System.out.println(f7.exists());
String s=f7.getPath();
System.out.println(s);
File f8=new File(s+"\\a.txt");
f8.createNewFile();
}
}