Skip to content

Commit 1c23128

Browse files
committed
Initial commit
0 parents  commit 1c23128

File tree

67 files changed

+13335
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+13335
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Project exclude paths
2+
/out/

.idea/.gitignore

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/uiDesigner.xml

+124
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

JavaLearn.iml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
<orderEntry type="module-library" exported="">
11+
<library>
12+
<CLASSES>
13+
<root url="jar://H:/Edge下载/commons-io-2.6/commons-io-2.6.jar!/" />
14+
</CLASSES>
15+
<JAVADOC />
16+
<SOURCES />
17+
</library>
18+
</orderEntry>
19+
<orderEntry type="module-library" exported="">
20+
<library>
21+
<CLASSES />
22+
<JAVADOC />
23+
<SOURCES>
24+
<root url="jar://H:/Edge下载/commons-io-2.6/commons-io-2.6-sources.jar!/" />
25+
</SOURCES>
26+
</library>
27+
</orderEntry>
28+
<orderEntry type="module-library" exported="">
29+
<library>
30+
<CLASSES>
31+
<root url="file://H:/Edge下载/quartz-2.4.0-SNAPSHOT/lib" />
32+
</CLASSES>
33+
<JAVADOC />
34+
<SOURCES />
35+
<jarDirectory url="file://H:/Edge下载/quartz-2.4.0-SNAPSHOT/lib" recursive="false" />
36+
</library>
37+
</orderEntry>
38+
</component>
39+
</module>

abc.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Hooray! It's snowing! It's time to make a snowman.James runs out.
2+
He makes a big pile of snow. He puts a big snowball on top. He adds a scarf and a hat.
3+
He adds an orange for the nose. He adds coal for the eyes and buttons.In the evening,
4+
James opens the door. What does he see? The snowman is moving! James invites him in.
5+
The snowman has never been inside a house. He says hello to the cat. He plays with paper towels.
6+
A moment later, the snowman takes James's hand and goes out.They go up, up, up into the air!
7+
They are flying! What a wonderful night!The next morning, James jumps out of bed.
8+
He runs to the door.He wants to thank the snowman. But he's gone

baidu.html

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<!DOCTYPE html>
2+
<!--STATUS OK--><html> <head><meta http-equiv=content-type content=text/html;charset=utf-8><meta http-equiv=X-UA-Compatible content=IE=Edge><meta content=always name=referrer><link rel=stylesheet type=text/css href=https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/bdorz/baidu.min.css><title>百度一下,你就知道</title></head> <body link=#0000cc> <div id=wrapper> <div id=head> <div class=head_wrapper> <div class=s_form> <div class=s_form_wrapper> <div id=lg> <img hidefocus=true src=//www.baidu.com/img/bd_logo1.png width=270 height=129> </div> <form id=form name=f action=//www.baidu.com/s class=fm> <input type=hidden name=bdorz_come value=1> <input type=hidden name=ie value=utf-8> <input type=hidden name=f value=8> <input type=hidden name=rsv_bp value=1> <input type=hidden name=rsv_idx value=1> <input type=hidden name=tn value=baidu><span class="bg s_ipt_wr"><input id=kw name=wd class=s_ipt value maxlength=255 autocomplete=off autofocus=autofocus></span><span class="bg s_btn_wr"><input type=submit id=su value=百度一下 class="bg s_btn" autofocus></span> </form> </div> </div> <div id=u1> <a href=http://news.baidu.com name=tj_trnews class=mnav>新闻</a> <a href=https://www.hao123.com name=tj_trhao123 class=mnav>hao123</a> <a href=http://map.baidu.com name=tj_trmap class=mnav>地图</a> <a href=http://v.baidu.com name=tj_trvideo class=mnav>视频</a> <a href=http://tieba.baidu.com name=tj_trtieba class=mnav>贴吧</a> <noscript> <a href=http://www.baidu.com/bdorz/login.gif?login&amp;tpl=mn&amp;u=http%3A%2F%2Fwww.baidu.com%2f%3fbdorz_come%3d1 name=tj_login class=lb>登录</a> </noscript> <script>document.write('<a href="http://www.baidu.com/bdorz/login.gif?login&tpl=mn&u='+ encodeURIComponent(window.location.href+ (window.location.search === "" ? "?" : "&")+ "bdorz_come=1")+ '" name="tj_login" class="lb">登录</a>');
3+
</script> <a href=//www.baidu.com/more/ name=tj_briicon class=bri style="display: block;">更多产品</a> </div> </div> </div> <div id=ftCon> <div id=ftConw> <p id=lh> <a href=http://home.baidu.com>关于百度</a> <a href=http://ir.baidu.com>About Baidu</a> </p> <p id=cp>&copy;2017&nbsp;Baidu&nbsp;<a href=http://www.baidu.com/duty/>使用百度前必读</a>&nbsp; <a href=http://jianyi.baidu.com/ class=cp-feedback>意见反馈</a>&nbsp;京ICP证030173号&nbsp; <img src=//www.baidu.com/img/gs.gif> </p> </div> </div> </div> </body> </html>

data.txt

105 Bytes
Binary file not shown.

dst.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
this is my output words have a see
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package cn.com.coderZoe.IO;
2+
3+
import java.io.*;
4+
import java.util.Arrays;
5+
6+
/**
7+
* @author yhs
8+
* @date 2020/4/2 15:06
9+
* @description
10+
*/
11+
public class Class10FileStreamAndByteArrayStream {
12+
/*
13+
* 流对接 之前都是单一流的处理 比如文件流读 文件流写 字节流读 字节流写
14+
* 现在的任务是 读取文件数据 转化为字节数组流输出 读取字节数组流转化为文件流输出
15+
*/
16+
17+
public static void main(String[] args) {
18+
//将文件流转为字节数组流
19+
File file = new File("西电.jpeg");
20+
byte src[] = null;
21+
FileInputStream fileInputStream = null;
22+
try {
23+
fileInputStream = new FileInputStream(file);
24+
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
25+
byte[] buff = new byte[1024];
26+
int len = -1;
27+
while((len=fileInputStream.read(buff))!=-1){
28+
byteArrayOutputStream.write(buff,0,len);
29+
}
30+
byteArrayOutputStream.flush();
31+
src = byteArrayOutputStream.toByteArray();
32+
//输出字节数组
33+
System.out.println(Arrays.toString(src));
34+
}catch (IOException e){
35+
e.printStackTrace();
36+
}finally {
37+
try {
38+
if(fileInputStream!=null){
39+
fileInputStream.close();
40+
}
41+
}catch (IOException e){
42+
e.printStackTrace();
43+
}
44+
}
45+
46+
//将字节数组转化为文件
47+
FileOutputStream fileOutputStream = null;
48+
ByteArrayInputStream byteArrayInputStream = null;
49+
File targetFile = new File("targetPicture.jpeg");
50+
try {
51+
//将src作为数据源
52+
byteArrayInputStream = new ByteArrayInputStream(src);
53+
fileOutputStream = new FileOutputStream(targetFile);
54+
byte[] buff = new byte[1024];
55+
int len = -1;
56+
while((len=byteArrayInputStream.read(buff))!=-1){
57+
fileOutputStream.write(buff,0,len);
58+
}
59+
fileOutputStream.flush();
60+
61+
}catch (IOException e){
62+
e.printStackTrace();
63+
}finally {
64+
if(fileOutputStream != null){
65+
try {
66+
fileOutputStream.close();
67+
}catch (IOException e){
68+
e.printStackTrace();
69+
}
70+
}
71+
}
72+
}
73+
}

0 commit comments

Comments
 (0)