freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

java語言程序設(shè)計基礎(chǔ)第2版java的輸入輸出系統(tǒng)ppt(編輯修改稿)

2024-11-12 16:19 本頁面
 

【文章內(nèi)容簡介】 wLine():為 BufferedWriter建立一個新行,即向其中插入一個表示新行的字符。 ? write(char[] cbuf, int off, int len):將給定的字符數(shù)組中從 off位置開始的指定數(shù)量的字符寫入到當(dāng)前的BufferedWriter中去 ? write(int c) :將給定的數(shù)據(jù)寫入到當(dāng)前的BufferedWriter中 ? write(String s, int off, int len):將給定的字符串中從 off位置開始的指定數(shù)量的字符寫入到當(dāng)前的BufferedWriter中去 2021/11/10 56 數(shù)據(jù)流( Data Stream) ?數(shù)據(jù)流是過濾流的子類 ?數(shù)據(jù)流完成了簡單數(shù)據(jù)類型的讀寫功能 ? Java I/O中的數(shù)據(jù)流構(gòu)件 – DataInputStream – DataOutputStream 2021/11/10 57 DataInputStream的構(gòu)造方法 ? DataInputStream(InputStream in):以給定的 InputStream為基礎(chǔ)構(gòu)造一個DataInputStream對象。 2021/11/10 58 DataInputStream中的方法 ? read(byte[] b):將 DataInputStream中的數(shù)據(jù)讀取到給定的數(shù)組中,同時返回實際讀取的位數(shù) ? read(byte[] b, int off, int len):從DataInputStream中讀取最多 len個字節(jié)的數(shù)據(jù),存放到字節(jié)數(shù)組 b中從 off開始的位置。 ? readBoolean():從 DataInputStream中讀取boolean數(shù)據(jù) ? readByte():從 DataInputStream中讀取 byte數(shù)據(jù) ? readChar() :從 DataInputStream中讀取 char類型數(shù)據(jù) 2021/11/10 59 DataInputStream中的方法 ? readDouble():從 DataInputStream中讀取 double類型數(shù)據(jù) ? readFloat():從 DataInputStream中讀取 float類型數(shù)據(jù) ? readFully(byte[] b):從 DataInputStream中讀取長度為給定數(shù)組長度的數(shù)據(jù),同時把數(shù)據(jù)保存到給定的數(shù)組中 ? readFully(byte[] b, int off, int len):從DataInputStream中讀取長度為給定長度的數(shù)據(jù),同時把數(shù)據(jù)保存到給定的數(shù)組中的給定位置上 ? readInt():從 DataInputStream中讀取 int類型數(shù)據(jù) 2021/11/10 60 DataInputStream中的方法 ? readLong():從 DataInputStream中讀取 long類型數(shù)據(jù) ? readShort():從 DataInputStream中讀取 short類型數(shù)據(jù) ? readUnsignedByte():從 DataInputStream中讀取從0到 255之間的數(shù)據(jù) ? readUnsignedShort():從 DataInputStream中讀取從 0到 65535之間的數(shù)據(jù) ? readUTF():從 DataInputStream中讀取 UTF8編碼的字符 ? skipBytes(int n) :從 DataInputStream中刪除給定位數(shù)的數(shù)據(jù)。 2021/11/10 61 DataOutputStream的構(gòu)造方法 ? DataOutputStream(OutputStream out) :以給定的 OutputStream為基礎(chǔ)構(gòu)造一個DataOutputStream對象 2021/11/10 62 DataOutputStream中的方法 ? size():返回被寫入到 DataOutputStream中的數(shù)據(jù)的位數(shù) ? writeBoolean(boolean v):將給定的 boolean值寫入到 DataOutputStream中 ? writeByte(int v):將 int值的 1位字節(jié)表示寫入到DataOutputStream中, int值必須在 0到 255之間 ? writeBytes(String s):將給定的字符串以字節(jié)方式寫入到 DataOutputStream中 ? writeChar(int v):將給定的 int值作為 2位的字節(jié)寫入到 DataOutputStream中 2021/11/10 63 DataOutputStream中的方法 ? writeChars(String s):將給定的字符串寫入到 DataOutputStream中 ? writeDouble(double v):將給定的 double數(shù)據(jù)寫入到 DataOutputStream中 ? writeFloat(float v):將給定的 float數(shù)據(jù)寫入到 DataOutputStream中 ? writeInt(int v):將給定的 int數(shù)據(jù)寫入到DataOutputStream中 2021/11/10 64 DataOutputStream中的方法 ? writeLong(long v):將給定的 long數(shù)據(jù)寫入到 DataOutputStream中。 ? writeShort(int v):將給定的 int值強(qiáng)制轉(zhuǎn)換成為 short類型數(shù)據(jù)同時寫入到DataOutputStream中。 ? writeUTF(String str) :將給定的字符串使用修改過的 UTF編碼,再寫入到DataOutputStream中。 2021/11/10 65 DataOutputStream舉例 import .*。 public class DataIODemo { public static void main(String[] args) throws IOException{ DataOutputStream out = new DataOutputStream( new FileOutputStream())。 double[] prices = { , , , , }。 int[] units = { 12, 8, 13, 29, 50 }。 String[] descs = { Java Tshirt,Java Mug, Duke Juggling Dolls,Java Pin, Java Key Chain }。 2021/11/10 66 for (int i = 0。 i 。 i ++) { (prices[i])。 (39。\t39。)。 (units[i])。 (39。\t39。)。 (descs[i])。 (39。\n39。)。 } ()。 DataInputStream in = new DataInputStream( new FileInputStream())。 double price , total = 。 int unit。 StringBuffer desc。 2021/11/10 67 try { while (true) { price = ()。 ()。 unit = ()。 ()。 char chr。 desc = new StringBuffer(20)。 2021/11/10 68 while ((chr = ()) != ?\n?) (chr)。 (You39。ve ordered + unit + units of +desc + at $ + price)。 total = total + unit * price。 } } catch (EOFException e) { } (For a TOTAL of: $ + total)。 ()。 } } 2021/11/10 69 Checked Stream ? Checked Stream是過濾流的子類 ?使用 Checked Stream時,可以在輸入和輸出數(shù)據(jù)時,記錄數(shù)據(jù)的個數(shù),通過個數(shù)來對數(shù)據(jù)進(jìn)行完整性校驗 ? Checked Stream不在 ,它存在于包 。 ? Checked Stream中的構(gòu)件為 – CheckedInputStream – CheckedOutputStream 2021/11/10 70 Checked Stream舉例 import .*。 import .*。 public class CheckedIOStreamDemo { public static void main(String[] args) throws Exception{ Adler32 inChecker = new Adler32()。 Adler32 outChecker = new Adler32()。 CheckedInputStream in = null。 CheckedOutputStream out = null。 2021/11/10 71 try { in = new CheckedInputStream(new FileInputStream(args[0]), inChecker)。 out = new CheckedOutputStream(new FileOutputStream(args[1]), outChecker)。 } catch (FileNotFoundException e) { (CheckedIODemo: + e)。 (1)。 } catch (IOException e) { (CheckedIODemo: + e)。 (1)。 } 2021/11/10 72 int c。 while ((c = ()) != 1){ (c)。 } (input checked sum: + ())。 (output checked sum: + ())。 ()。 ()。 } } 2021/11/10 73 LineNumber Stream ? LineNumber Stream是過濾流的子類 ? LineNumber Stream提供了按行讀取內(nèi)容的方法 ? LineNumber Stream不提供輸出的功能 ? Java I/O中的 LineNumber Stream構(gòu)件 – LineNumberReader – LineNumberInputStream( Deprecated)
點擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1