Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
START
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liml
START
Commits
37fb8482
Commit
37fb8482
authored
Sep 11, 2020
by
liml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git 测试
parents
Pipeline
#316
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
0 deletions
+67
-0
ScannerDemo.java
ScannerDemo.java
+67
-0
No files found.
ScannerDemo.java
0 → 100644
View file @
37fb8482
package
com
.
caiyang
.
li
.
util
;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.util.Scanner
;
public
class
ScannerDemo
{
/**
* 通过控制台输出文本
*/
public
void
FileStream
(){
Scanner
scanner
=
new
Scanner
(
System
.
in
);
System
.
out
.
println
(
"nextLine方式接收:"
);
if
(
scanner
.
hasNextLine
()){
String
line
=
scanner
.
nextLine
();
System
.
out
.
println
(
"输入数据"
+
line
);
ScannerDemo
scannerDemo
=
new
ScannerDemo
();
this
.
Filelist
(
line
.
getBytes
());
}
scanner
.
close
();
}
public
void
Filelist
(
byte
bWrite
[]){
File
file
=
new
File
(
"C:/text.txt"
);
try
{
FileOutputStream
stream
=
new
FileOutputStream
(
file
,
true
);
for
(
int
i
=
0
;
i
<
bWrite
.
length
;
i
++){
stream
.
write
(
bWrite
[
i
]);
}
stream
.
close
();
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment