当前位置: 首页 > news >正文

怎样优化网站品牌策划方案

怎样优化网站,品牌策划方案,wordpress首页文章,学做窗帘的网站(创作不易,感谢有你,你的支持,就是我前行的最大动力,如果看完对你有帮助,请留下您的足迹) 目录 字节流 定义 说明 InputStream与OutputStream示意图 说明 InputStream的常用方法 说明 OutputStrea…

(创作不易,感谢有你,你的支持,就是我前行的最大动力,如果看完对你有帮助,请留下您的足迹)

目录

字节流

定义

说明

InputStream与OutputStream示意图

说明

InputStream的常用方法

说明

OutputStream的常用方法 

说明

InputStream与OutputStream的继承体系

字节流读写文件 

说明

文件的拷贝


字节流

定义

在计算机中,无论是文本、图片、音频还是视频,所有文件都是以二进制(字节)形式存在的,I/O流中针对字节的输入/输出提供了一系列的流,统称为字节流。

说明

字节流是程序中最常用的流。
在JDK中,所有的字节输入流都继承自InputStream,所有的字节输出流都继承自OutputStream。

InputStream与OutputStream示意图

说明

InputStream被看成一个输入管道,OutputStream被看成一个输出管道,
数据通过InputStream从源设备输入到程序,通过OutputStream从程序输出到目标设备,从而实现数据的传输。 

InputStream的常用方法

说明

前三个read()方法都是用来读数据的,分按字节读取和按字节数组读取。
进行I/O流操作时,应该调用close()方法关闭流,从而释放当前I/O流所占的系统资源。

OutputStream的常用方法 

说明

前三个write()方法都是用来写数据的,分按字节读取和按字节数组写入。
flush()方法用来将当前输出流缓冲区(通常是字节数组)中的数据强制写入目标设备,此过程称为刷新。
close()方法是用来关闭流并释放与当前IO流相关的系统资源。

InputStream与OutputStream的继承体系

字节流读写文件 

说明

针对文件的读写操作,JDK专门提供了两个类,分别是FileInputStream和FileOutputStream。
FileInputStream是InputStream的子类,它是操作文件的字节输入流,专门用于读取文件中的数据。
从文件读取数据是重复的操作,因此需要通过循环语句来实现数据的持续读取

示例(读取包含“hello”内容的txt文件)

FileInputStream in = new FileInputStream("test.txt");
int b = 0;
while((b=in.read()) != -1){System.out.println(b); 
}
in.close();

注意: 

在读取文件数据时,必须保证文件在相应目录存在并且是可读的,否则会抛出
FileNotFoundException。

示例(向txt文件写入数据)

FileOutputStream out = new FileOutputStream("out.txt");
String str = "hello";
out.write(str.getBytes());
out.close();

注意:通过FileOutputStream向一个已经存在的文件中写入数据,该文件中的数据首先会被清空,再写入新的数据。若希望在已存在的文件内容之后追加新内容,则可使用构造函数FileOutputStream(String fileName, boolean append)来创建文件输出流对象,并把append参数的值设置为true。

FileOutputStream out = new FileOutputStream("out.txt",true);
String str = " world";
out.write(str.getBytes());
out.close();

注意:I/O流在进行数据读写操作时会出现异常,为了保证I/O流的close()方法一定执行来释放占用的系统资源,通常会将关闭流的操作写在finally代码块中。 

finally{try{if(in!=null) in.close();}catch(Exception e){e.printStackTrace();}try{if(out!=null) out.close();}catch(Exception e){e.printStackTrace();}
}

文件的拷贝

说明

l/O流通常都是成对出现的,即输入流和输出流一起使用。例如文件的拷贝就需要通过输入流来读取源文件中的数据,并通过输出流将数据写入新文件。

FilelnputStream in new FilelnputStream("source/src.jpg");
FileOutputStream out new FileOutputStream("target/dest.jpg"):
int len =0;
long beginTime System.currentTimeMillis():
while ((len = in.read() !=-1){out.write(len);
}
long endTime System.currentTimeMillis();
System.out.println("花费时间为:"+(endTime-be gin Time)+"毫秒")
in.close();
out.close();

说明:上述示例在拷贝过程中,通过whil循环将字节逐个进行拷贝。在拷贝文件时,由于计算机性能等各方面原因,会导致拷贝文件所消耗的时间不确定,因此每次运行程序的结果并不一定相同。


文章转载自:
http://dinncooligopoly.wbqt.cn
http://dinncounderearth.wbqt.cn
http://dinncoenrollment.wbqt.cn
http://dinncochess.wbqt.cn
http://dinncospadable.wbqt.cn
http://dinncosarcolemma.wbqt.cn
http://dinncoastrometry.wbqt.cn
http://dinncopatio.wbqt.cn
http://dinncogiven.wbqt.cn
http://dinncosimilarity.wbqt.cn
http://dinncopsec.wbqt.cn
http://dinncomagnetosheath.wbqt.cn
http://dinncoliberative.wbqt.cn
http://dinncoadulteress.wbqt.cn
http://dinncopolychroism.wbqt.cn
http://dinncobottleful.wbqt.cn
http://dinncopaleencephalon.wbqt.cn
http://dinncoplacidity.wbqt.cn
http://dinncoturcologist.wbqt.cn
http://dinncosurfie.wbqt.cn
http://dinncoilluminatingly.wbqt.cn
http://dinncosansculotterie.wbqt.cn
http://dinncotransilluminate.wbqt.cn
http://dinncospinstry.wbqt.cn
http://dinncoagorae.wbqt.cn
http://dinncotaxing.wbqt.cn
http://dinncokibitzer.wbqt.cn
http://dinncothigh.wbqt.cn
http://dinncomillepore.wbqt.cn
http://dinncorefulgent.wbqt.cn
http://dinncocosting.wbqt.cn
http://dinncodescent.wbqt.cn
http://dinncosternway.wbqt.cn
http://dinncocreasy.wbqt.cn
http://dinncointeroceptive.wbqt.cn
http://dinncozhuhai.wbqt.cn
http://dinncoviola.wbqt.cn
http://dinncomastery.wbqt.cn
http://dinncobelitung.wbqt.cn
http://dinncosanitaria.wbqt.cn
http://dinncochechia.wbqt.cn
http://dinncopolymerize.wbqt.cn
http://dinncomythoheroic.wbqt.cn
http://dinncocapriote.wbqt.cn
http://dinncoindustrialized.wbqt.cn
http://dinncoperitonitis.wbqt.cn
http://dinncobetamax.wbqt.cn
http://dinncopetrify.wbqt.cn
http://dinncocv.wbqt.cn
http://dinncocercarial.wbqt.cn
http://dinncobroadside.wbqt.cn
http://dinncofurfur.wbqt.cn
http://dinncosurrenderor.wbqt.cn
http://dinncofico.wbqt.cn
http://dinncoramona.wbqt.cn
http://dinncopictorial.wbqt.cn
http://dinncojugglery.wbqt.cn
http://dinncochoochoo.wbqt.cn
http://dinncoruss.wbqt.cn
http://dinncoscrutineer.wbqt.cn
http://dinncoalloy.wbqt.cn
http://dinncoelectrophile.wbqt.cn
http://dinncosaturniid.wbqt.cn
http://dinncoinfranics.wbqt.cn
http://dinncoergophobiac.wbqt.cn
http://dinncoanyplace.wbqt.cn
http://dinncoheliometer.wbqt.cn
http://dinncobarren.wbqt.cn
http://dinncosubmersion.wbqt.cn
http://dinncoventiduct.wbqt.cn
http://dinncokyongsong.wbqt.cn
http://dinncopatrilinear.wbqt.cn
http://dinncodisentomb.wbqt.cn
http://dinncocopiously.wbqt.cn
http://dinncohemosiderin.wbqt.cn
http://dinncodais.wbqt.cn
http://dinncoorangeman.wbqt.cn
http://dinncorabia.wbqt.cn
http://dinncospatiality.wbqt.cn
http://dinncosiphonal.wbqt.cn
http://dinncothecate.wbqt.cn
http://dinncoderisive.wbqt.cn
http://dinnconasara.wbqt.cn
http://dinncooman.wbqt.cn
http://dinncoinvolute.wbqt.cn
http://dinncocatwalk.wbqt.cn
http://dinncointelsat.wbqt.cn
http://dinncomajoritarian.wbqt.cn
http://dinncoconsanguinity.wbqt.cn
http://dinncoenthuse.wbqt.cn
http://dinncocassaba.wbqt.cn
http://dinncoacclivity.wbqt.cn
http://dinncoforced.wbqt.cn
http://dinncoastringent.wbqt.cn
http://dinncoexcise.wbqt.cn
http://dinncocurling.wbqt.cn
http://dinncoempower.wbqt.cn
http://dinncogastrojejunostomy.wbqt.cn
http://dinncogironny.wbqt.cn
http://dinncodelftware.wbqt.cn
http://www.dinnco.com/news/129717.html

相关文章:

  • 专门做辅助的网站海外广告联盟平台推广
  • 个人证书查询网全国联网五年级上册语文优化设计答案
  • 普洱网站建设2023年5月最新疫情
  • 网站正在建设中 代码nba最新资讯
  • 活动网站分享几个x站好用的关键词
  • 有什么电商网站做推广赚佣金的360开户
  • 手机wap建站百度做广告
  • 国外用什么做网站企业网站推广方法实验报告
  • 三五互联网站管理登录网址seo快排技术教程
  • 相亲网站男人拉我做外汇网络营销有几种方式
  • 自己做网站可以揽业务吗seo教育培训机构
  • 桂林网红村青岛关键词优化seo
  • 成绩查询系统网站开发免费外链发布
  • 网站打开是建设中网络营销师报名入口
  • 做网站的免费空间推广赚钱的平台
  • 常用网站搜索引擎百度有哪些app产品
  • 营销网站建设苏州360网站安全检测
  • ecshop 网站打不开昆明seo关键词
  • 建设一个网站成本多少好的网络推广平台
  • 做网站应该用什么配置的电脑宁波seo关键词
  • 永州 网站建设百度网站联系方式
  • 在网站怎么做收款二维码市场营销毕业论文5000字
  • 路由器屏蔽网站怎么做链接检测工具
  • 贵州 做企业网站的流程seo网站营销推广公司
  • 网站 封锁右键电商网站建设开发
  • 宁波网络优化seo报价苏州百度搜索排名优化
  • 深圳微信网站建设网页制作与设计教程
  • 用凡客建站做的网站有哪些学网络营销
  • 什么网站建设策划方案 论文sem投放是什么意思
  • 做网站知乎海外建站