FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Programming/Java NIO/PathIO.java at main · yogesh5259/Java-Programming · GitHub
yogesh5259
/
Java-Programming
Public
Notifications
You must be signed in to change notification settings
Fork
2
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java-Programming
/
Java NIO
/
PathIO.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
43 lines (28 loc) · 863 Bytes
Breadcrumbs
Java-Programming
/
Java NIO
/
PathIO.java
Copy path
File metadata and controls
43 lines (28 loc) · 863 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import
java
.
io
.
InputStream
;
import
java
.
io
.
OutputStream
;
import
java
.
nio
.
file
.
Files
;
import
java
.
nio
.
file
.
Path
;
import
java
.
nio
.
file
.
Paths
;
// read and Write From the File By Using Java NIO package
public
class
Path_nio
{
public
static
void
main
(
String
[]
args
) {
try
{
// Specify the File
Path
filePath
=
Paths
.
get
(
"G:/1.txt"
);
// For Write The data
OutputStream
outputStream
=
Files
.
newOutputStream
(
filePath
);
// Write String as Bytes
outputStream
.
write
(
"Write Data Using JAVA_NIO"
.
getBytes
());
outputStream
.
close
();
// For read the Data
InputStream
inputStream
=
Files
.
newInputStream
(
filePath
);
// read Status
int
readStatus
=
1
;
// One by One Character Read from the File
while
((
readStatus
=
inputStream
.
read
()) != -
1
) {
System
.
out
.
print
((
char
)
readStatus
);
}
}
catch
(
Exception
e
) {
}
}
}
Back
|
FazBrowse Home
|
New Git URL