??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品一区在线播放,欧美高清免费,国模叶桐国产精品一区http://www.aygfsteel.com/hanxifeng1999/fayewongzh-cnSat, 17 May 2025 01:49:58 GMTSat, 17 May 2025 01:49:58 GMT60Servlethttp://www.aygfsteel.com/hanxifeng1999/archive/2009/03/31/263220.htmlfayefayeTue, 31 Mar 2009 11:42:00 GMThttp://www.aygfsteel.com/hanxifeng1999/archive/2009/03/31/263220.htmlhttp://www.aygfsteel.com/hanxifeng1999/comments/263220.htmlhttp://www.aygfsteel.com/hanxifeng1999/archive/2009/03/31/263220.html#Feedback0http://www.aygfsteel.com/hanxifeng1999/comments/commentRss/263220.htmlhttp://www.aygfsteel.com/hanxifeng1999/services/trackbacks/263220.html阅读全文

faye 2009-03-31 19:42 发表评论
]]>
JDBChttp://www.aygfsteel.com/hanxifeng1999/archive/2009/03/31/263219.htmlfayefayeTue, 31 Mar 2009 11:41:00 GMThttp://www.aygfsteel.com/hanxifeng1999/archive/2009/03/31/263219.htmlhttp://www.aygfsteel.com/hanxifeng1999/comments/263219.htmlhttp://www.aygfsteel.com/hanxifeng1999/archive/2009/03/31/263219.html#Feedback0http://www.aygfsteel.com/hanxifeng1999/comments/commentRss/263219.htmlhttp://www.aygfsteel.com/hanxifeng1999/services/trackbacks/263219.html阅读全文

faye 2009-03-31 19:41 发表评论
]]>
IOhttp://www.aygfsteel.com/hanxifeng1999/archive/2009/03/31/263218.htmlfayefayeTue, 31 Mar 2009 11:40:00 GMThttp://www.aygfsteel.com/hanxifeng1999/archive/2009/03/31/263218.htmlhttp://www.aygfsteel.com/hanxifeng1999/comments/263218.htmlhttp://www.aygfsteel.com/hanxifeng1999/archive/2009/03/31/263218.html#Feedback0http://www.aygfsteel.com/hanxifeng1999/comments/commentRss/263218.htmlhttp://www.aygfsteel.com/hanxifeng1999/services/trackbacks/263218.html 

Input / Output:指跨出JVM的边?/span>,与外界数据的源头或者目标数据源q行数据交换.

 

                    输出  Output

      ------------------------------->

JVM                                           数据?/span>

      <-------------------------------

                    输入   Input

注意Q输?/span>/输出是针?/span>JVM 而言?/span>

File c?/span>

可表CZ个文Ӟ也有可能是一个目?/span>(?/span>JAVA中文件和目录都属于这个类中,而且区分不是非常的明显,可以调用isDirectory()?/span>isFile()来判?/span>)?/span>

常用的方法:

      exists()       用来判断 文g或目录是否存在?/span>

      isDirectory()      判断是否是目?/span>

      isFile()              判断是否是文?/span>

      mkdir()             创徏目录

      mkdirs()           创徏目录包括它下面的子目录?/span>

      getAbsolutePath()      得到文gl对路径

      getParentFile() 得到父目录的File对象

      list()                 得到文g名的String数组 (得到当前目录下的文g名,目录?/span>)

      listFiles()           q回Filecd数组Q?/span>(目录,文g?/span>File对象)可用getName()得到文g名?/span>

      delete()      删除文g

      getName()         得到文g?/span>

      getPath()           得到文g相对路径

      separtor()          得到文g分隔W?/span> //q个Ҏ有更好的通用?/span>,q_不同l果不同

      deleteOnExit()    在进E退出的时候删除文?/span>,常用在时文件的删除?/span>

1、流的概念:

             输出?/span>

      E序----------->文g、网l?/span>

      E序<-----------数据来源  

           输入?/span>

2、流的分c:

      按处理方式来分:

           字节:?/span>8位传?/span> InputStream OutputStream

           字符:?/span>16位传?/span> Reader  Writer

      按功能来分:

           节点:与文件、网l打交道的流Q操作数据的来源

           处理?/span>(包装?/span>)Q操作节Ҏ

      如何区分Q?/span>       

           输入:?/span>InputStream?/span>Readerl尾的流

                      FileInputStream   BufferedReader

           输出:?/span>OutputStream?/span>Writerl尾的流

                      FileOutputStream PrintWriter

           字节:?/span>InputStream?/span>OutputStreaml尾的流

           字符:?/span>Reader?/span>Writerl尾的流

           节点:看构造器Q参Cؓ数据来源Q参数是String?/span>File之类?/span>

                      new FileInputStream("d:\\abc.txt");

                      new FileOutputStream(new File("d:\\abc.txt"))

           处理:构造器的参Cؓ其它?/span>

                      new BufferedReader(new InputStreamReader(new FileInputStream("d:\\abc.txt")));

      选择时Q?/span>

           首先定是输入还是输出?/span>

           其次定是字节流q是字符?/span>

           然后定是节Ҏq是处理?/span>

      Ҏ数据cd选择输入/输出:

           ①byte?/span>byte[]   InputStream / OutputStream

           ②int?/span>byte?/span>char?/span>double     DataInputStream / DataOutputStream

           ③char?/span>String    Reader / Writer

           ④Object           ObjectInputStream / ObjectOutputStream

           若考虑性能会在前试着?/span>Buffered

3、常用流Q?/span>

      DataInputStream&DataOutputStream 用于d基本cd数据Q如int?/span>float?/span>long?/span>double?/span>boolean{?/span>

      此外Q?/span>DataInputStream?/span>readUTF()Ҏq能d采用UTF-8字符~码的字W串?/span>

     

      BufferedInputStream&BufferedOutputStream

      因ؓ利用了缓冲区Q所以常用于提高d数据的效率?/span>

      BufferedInputStream先把一Ҏ据读入到~冲区,接下?/span>readҎ只需要从~冲区内获得数据Q减了物理性读取数据的ơ数?/span>

      可以使用BufferedInputStream(InputStream in, int size) 中的size来指定缓冲区的大?/span>

 

      ObjectOutputStream&ObjectInputStream

      对象的序列化是指把对象写C个输出流中,

      对象的反序列化是指从一个输入流中读取一个对象?/span>

      Java语言要求只有实现?/span>java.io.Serializable接口的类的对象才能序列化和反序列?/span>

 

      Reader/Writer

      当需要程序读写文本文Ӟ而且文本文g采用特定的字W编码集Ӟ应采?/span>Reader/Writer?/span>

      InputStreamReader & OutputStreamWriter 桥梁?/span>

      把字节流转换成字W流

      在桥转换的时候可以指定编解码方式

     

      BufferedReader

      readLine()Ҏ可以一ơ读入一行字W,以字W串形式q回?/span>

      BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("file"),"UTF-8"));

      BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("file"),"UTF-8"));

      PrintWriter 输出格式化的数据Q所有的写数据的Ҏ?/span>print开头?/span>

      print (int i)

      print (long l)

      print (float f)

      print (String s)

     

      每个print() Ҏ都有一?/span>println()Ҏ对应

     

      a.

      printWriter.println("Hello");

      b.

      printWriter.print("Hello");

      printWriter.println();

      c.

      printWriter.print("Hello\n");

      以上三段代码是等L

4?/span>JAVA~码问题Q?/span>UTF-8,GBKQ?/span>GB2312是可以显CZ文的?/span>

      ASCII                一个字W?/span>-----1B     M一U编码均兼容   A<-->65

      ISO8859-1 (西欧)     一个字W?/span>-----1B

      GB2312 / GBK   一个字W?/span>-----2B

      Unicode       一个字W?/span>-----2B     会增加网l负?/span>  Java中的char?/span>Unicode

      UTF-8        变长字节(变长?/span>Unicode方式)

                 英文-----1B

                 中文-----3B

      提供~码帮助的类Q?/span>java.nio.charset.Charset

      GBK---中、日、韩Q?/span>gb2312?/span>GBK的子?/span>

 

      会出C文编码问题的情况Q?/span>

           1、用操作文件时

           2、网?/span>(动态、静?/span>)

           3、网l传递信息时

      String--->q(再次转码)

      String temp=p.getProperty("name");

      temp=new String(temp.getBytes("ISO8859-1"),"GBK");q两处的~码有时需要互换位|?/span>

对象序列?/span>

      1Q定义:把对象作Z个整体,?/span>I/O中传播

      2Q语法:

      (Q?/span>)实现?/span>Serializeble接口的对象才能可序列化。这个接口里没有MҎQ没有方法的接口UCؓ标记接口?/span>

      例如Q?/span>class Student implements Serializeble{} 

      (Q?/span>)如果一个序列化后的对象里面有一个属性是个对象属性,那么q个对象属性也需要实现序列化?/span>

      例如Q?/span>class Student implements Serializeble{

           Teacher t;//必须序列?/span>

           }

           class Teacher implements Serializeble{}

      (3)包名、类名、属性可以被序列?/span>

      Ҏ、构造器不会序列?/span>

      所有的静态属性都不会被序列化

      ?/span>transient关键字修饰的属性是临时属性,临时属性不参与序列化?/span>

      3Q用注意:

      a.?/span>readObjectL件的时候,当文件结束的时候会抛出EOFExceptionQ当我们捕获q个异常的时候,E序q束了?/span>

      b.如果需要向一个文件中q加对象Q首先要把文件中原有的对象读出来Q再把原有对象和新追加的对象一起写入到文g?/span>     

      c. serialVersionUID是静态常量,表示当前对象的版本号Q在接受传输的数据时会自动检查该|保证版本的相同?/span>

java.util.Properties属性类Q针对属性文件操作,早期使用?/span>

      好处是可以在不修改代码的情况下改变相应的需求?/span>

      文g名以.propertiesl尾的文件称为属性文?/span>

      文g的内ҎQ名?/span>=?/span> 的Ş?/span>

      常用ҎQ?/span>  

           public void load(InputStream inStream)throws IOException

           从输入流中读取属性列?/span>

           public void store(OutputStream out,String comments)throws IOException

           把属性列表写入输出流

           public String getProperty(String key)

           public String getProperty(String key,String defaultValue)

           public Object setProperty(String key,String value)



faye 2009-03-31 19:40 发表评论
]]>
Hibernatehttp://www.aygfsteel.com/hanxifeng1999/archive/2009/03/31/263217.htmlfayefayeTue, 31 Mar 2009 11:39:00 GMThttp://www.aygfsteel.com/hanxifeng1999/archive/2009/03/31/263217.htmlhttp://www.aygfsteel.com/hanxifeng1999/comments/263217.htmlhttp://www.aygfsteel.com/hanxifeng1999/archive/2009/03/31/263217.html#Feedback0http://www.aygfsteel.com/hanxifeng1999/comments/commentRss/263217.htmlhttp://www.aygfsteel.com/hanxifeng1999/services/trackbacks/263217.html阅读全文

faye 2009-03-31 19:39 发表评论
]]>
AJAXhttp://www.aygfsteel.com/hanxifeng1999/archive/2009/03/31/263216.htmlfayefayeTue, 31 Mar 2009 11:37:00 GMThttp://www.aygfsteel.com/hanxifeng1999/archive/2009/03/31/263216.htmlhttp://www.aygfsteel.com/hanxifeng1999/comments/263216.htmlhttp://www.aygfsteel.com/hanxifeng1999/archive/2009/03/31/263216.html#Feedback0http://www.aygfsteel.com/hanxifeng1999/comments/commentRss/263216.htmlhttp://www.aygfsteel.com/hanxifeng1999/services/trackbacks/263216.html阅读全文

faye 2009-03-31 19:37 发表评论
]]>
վ֩ģ壺 | μԴ| | ʻ| ƽ| ƽ| ν| | | ͭɽ| ɽ| | | ɶ| ƽ| | | | | | | | | | ۰| | | Ž| | | | ̨ǰ| | | ˼é| | | | | пѷ| |