FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java/java-inputstream-string/src/main/java/com/hmkcode/App.java at master · qdhq/Java · GitHub
qdhq
Java
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Java
/
java-inputstream-string
/
src
/
main
/
java
/
com
/
hmkcode
/
App.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (22 loc) · 1.18 KB
Breadcrumbs
Java
/
java-inputstream-string
/
src
/
main
/
java
/
com
/
hmkcode
/
App.java
Copy path
File metadata and controls
31 lines (22 loc) · 1.18 KB
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
package
com
.
hmkcode
;
import
java
.
io
.
ByteArrayInputStream
;
import
java
.
io
.
IOException
;
import
java
.
io
.
InputStream
;
public
class
App
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
// 1. By java.util.Scanner
InputStream
inputStream
=
new
ByteArrayInputStream
(
"hmkcode..inputStream to String"
.
getBytes
());
System
.
out
.
println
(
"getStringByScanner: "
+
InputStreamToString
.
getStringByScanner
(
inputStream
));
// 2. By BufferedReader
inputStream
=
new
ByteArrayInputStream
(
"hmkcode..inputStream to String"
.
getBytes
());
System
.
out
.
println
(
"getStringByBufferedReader: "
+
InputStreamToString
.
getStringByBufferedReader
(
inputStream
));
// 3. By Apache IO
inputStream
=
new
ByteArrayInputStream
(
"hmkcode..inputStream to String"
.
getBytes
());
System
.
out
.
println
(
"getStringByApacheIO IOUtils.toString: "
+
InputStreamToString
.
getStringByApacheIO_toString
(
inputStream
));
// 4. By Apache IO
inputStream
=
new
ByteArrayInputStream
(
"hmkcode..inputStream to String"
.
getBytes
());
System
.
out
.
println
(
"getStringByApacheIO IOUtils.copy: "
+
InputStreamToString
.
getStringByApacheIO_copy
(
inputStream
));
}
}
Back
|
FazBrowse Home
|
New Git URL