home *** CD-ROM | disk | FTP | other *** search
/ Sams Teach Yourself C in 21 Days (6th Edition) / STYC216E.ISO / mac / Examples / Day27 / writing.java < prev   
MacBinary  |  2002-05-26  |  1.6 KB  |  [TEXT/LMAN]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Sun May 26 12:19:28 2002, modified Sun May 26 12:19:28 2002, creator 'LMAN', type ASCII, 1083 bytes "writing.java" , at 0x4bb 286 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[LMAN]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0c 77 72 69 74 69 6e | 67 2e 6a 61 76 61 00 00 |..writin|g.java..|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4c 4d 41 | 4e 00 00 ff ff ff ff 00 |.TEXTLMA|N.......|
|00000050| 00 00 00 00 00 04 3b 00 | 00 01 1e b9 16 bb 90 b9 |......;.|........|
|00000060| 16 bb 90 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 26 f0 00 00 |........|....&...|
|00000080| 69 6d 70 6f 72 74 20 6a | 61 76 61 2e 6c 61 6e 67 |import j|ava.lang|
|00000090| 2e 53 79 73 74 65 6d 3b | 69 6d 70 6f 72 74 20 6a |.System;|import j|
|000000a0| 61 76 61 2e 69 6f 2e 2a | 3b 0d 0a 0d 0a 70 75 62 |ava.io.*|;....pub|
|000000b0| 6c 69 63 20 63 6c 61 73 | 73 20 57 72 69 74 65 54 |lic clas|s WriteT|
|000000c0| 65 78 74 46 69 6c 65 20 | 7b 20 0d 0a 20 20 70 75 |extFile |{ .. pu|
|000000d0| 62 6c 69 63 20 73 74 61 | 74 69 63 20 76 6f 69 64 |blic sta|tic void|
|000000e0| 20 6d 61 69 6e 28 53 74 | 72 69 6e 67 20 61 72 67 | main(St|ring arg|
|000000f0| 73 5b 5d 29 20 7b 0d 0a | 20 20 20 20 53 74 72 69 |s[]) {..| Stri|
|00000100| 6e 67 20 73 3b 0d 0a 20 | 20 20 20 42 75 66 66 65 |ng s;.. | Buffe|
|00000110| 72 65 64 52 65 61 64 65 | 72 20 6b 62 3b 0d 0a 20 |redReade|r kb;.. |
|00000120| 20 20 20 62 6f 6f 6c 65 | 61 6e 20 66 69 6c 65 45 | boole|an fileE|
|00000130| 72 72 6f 72 20 3d 20 66 | 61 6c 73 65 3b 0d 0a 0d |rror = f|alse;...|
|00000140| 0a 20 20 20 20 6b 62 20 | 3d 20 6e 65 77 20 42 75 |. kb |= new Bu|
|00000150| 66 66 65 72 65 64 52 65 | 61 64 65 72 28 6e 65 77 |fferedRe|ader(new|
|00000160| 20 49 6e 70 75 74 53 74 | 72 65 61 6d 52 65 61 64 | InputSt|reamRead|
|00000170| 65 72 28 53 79 73 74 65 | 6d 2e 69 6e 29 29 3b 0d |er(Syste|m.in));.|
|00000180| 0a 20 20 20 20 74 72 79 | 20 7b 0d 0a 20 20 20 20 |. try| {.. |
|00000190| 20 20 20 20 46 69 6c 65 | 57 72 69 74 65 72 20 6f | File|Writer o|
|000001a0| 75 74 46 69 6c 65 20 3d | 20 6e 65 77 20 46 69 6c |utFile =| new Fil|
|000001b0| 65 57 72 69 74 65 72 28 | 22 63 3a 5c 5c 6f 75 74 |eWriter(|"c:\\out|
|000001c0| 70 75 74 2e 74 78 74 22 | 29 3b 0d 0a 20 20 20 20 |put.txt"|);.. |
|000001d0| 20 20 20 20 42 75 66 66 | 65 72 65 64 57 72 69 74 | Buff|eredWrit|
|000001e0| 65 72 20 62 75 66 66 20 | 3d 20 6e 65 77 20 42 75 |er buff |= new Bu|
|000001f0| 66 66 65 72 65 64 57 72 | 69 74 65 72 28 6f 75 74 |fferedWr|iter(out|
|00000200| 46 69 6c 65 29 3b 0d 0a | 20 20 20 20 20 20 20 20 |File);..| |
|00000210| 53 79 73 74 65 6d 2e 6f | 75 74 2e 70 72 69 6e 74 |System.o|ut.print|
|00000220| 6c 6e 28 22 45 6e 74 65 | 72 20 6c 69 6e 65 73 20 |ln("Ente|r lines |
|00000230| 6f 66 20 74 65 78 74 20 | 74 6f 20 70 75 74 20 69 |of text |to put i|
|00000240| 6e 20 74 68 65 20 66 69 | 6c 65 2e 22 29 3b 0d 0a |n the fi|le.");..|
|00000250| 20 20 20 20 20 20 20 20 | 53 79 73 74 65 6d 2e 6f | |System.o|
|00000260| 75 74 2e 70 72 69 6e 74 | 6c 6e 28 22 45 6e 74 65 |ut.print|ln("Ente|
|00000270| 72 20 61 20 62 6c 61 6e | 6b 20 6c 69 6e 65 20 77 |r a blan|k line w|
|00000280| 68 65 6e 20 64 6f 6e 65 | 2e 22 29 3b 0d 0a 20 20 |hen done|.");.. |
|00000290| 20 20 20 20 20 20 62 6f | 6f 6c 65 61 6e 20 64 6f | bo|olean do|
|000002a0| 6e 65 20 3d 20 66 61 6c | 73 65 3b 0d 0a 20 20 20 |ne = fal|se;.. |
|000002b0| 20 20 20 20 20 77 68 69 | 6c 65 20 28 21 64 6f 6e | whi|le (!don|
|000002c0| 65 29 20 7b 0d 0a 20 20 | 20 20 20 20 20 20 20 20 |e) {.. | |
|000002d0| 73 20 3d 20 6b 62 2e 72 | 65 61 64 4c 69 6e 65 28 |s = kb.r|eadLine(|
|000002e0| 29 3b 0d 0a 20 20 20 20 | 20 20 20 20 20 20 69 66 |);.. | if|
|000002f0| 20 28 73 2e 6c 65 6e 67 | 74 68 28 29 20 3e 20 30 | (s.leng|th() > 0|
|00000300| 20 29 20 7b 0d 0a 20 20 | 20 20 20 20 20 20 20 20 | ) {.. | |
|00000310| 20 20 73 20 3d 20 73 20 | 2b 20 22 5c 6e 22 3b 0d | s = s |+ "\n";.|
|00000320| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 62 75 66 |. | buf|
|00000330| 66 2e 77 72 69 74 65 28 | 73 29 3b 0d 0a 20 20 20 |f.write(|s);.. |
|00000340| 20 20 20 20 20 20 20 7d | 0d 0a 20 20 20 20 20 20 | }|.. |
|00000350| 20 20 20 20 65 6c 73 65 | 0d 0a 20 20 20 20 20 20 | else|.. |
|00000360| 20 20 20 20 20 20 64 6f | 6e 65 20 3d 20 74 72 75 | do|ne = tru|
|00000370| 65 3b 0d 0a 20 20 20 20 | 20 20 20 20 7d 0d 0a 20 |e;.. | }.. |
|00000380| 20 20 20 20 20 20 20 62 | 75 66 66 2e 63 6c 6f 73 | b|uff.clos|
|00000390| 65 28 29 3b 0d 0a 20 20 | 20 20 7d 0d 0a 20 20 20 |e();.. | }.. |
|000003a0| 20 63 61 74 63 68 20 28 | 49 4f 45 78 63 65 70 74 | catch (|IOExcept|
|000003b0| 69 6f 6e 20 65 29 20 7b | 0d 0a 20 20 20 20 20 20 |ion e) {|.. |
|000003c0| 20 20 53 79 73 74 65 6d | 2e 6f 75 74 2e 70 72 69 | System|.out.pri|
|000003d0| 6e 74 6c 6e 28 22 45 72 | 72 6f 72 3a 20 22 20 2b |ntln("Er|ror: " +|
|000003e0| 20 65 2e 74 6f 53 74 72 | 69 6e 67 28 29 29 3b 0d | e.toStr|ing());.|
|000003f0| 0a 20 20 20 20 20 20 20 | 20 66 69 6c 65 45 72 72 |. | fileErr|
|00000400| 6f 72 20 3d 20 74 72 75 | 65 3b 0d 0a 20 20 20 20 |or = tru|e;.. |
|00000410| 7d 0d 0a 20 20 20 20 69 | 66 20 28 21 66 69 6c 65 |}.. i|f (!file|
|00000420| 45 72 72 6f 72 29 0d 0a | 20 20 20 20 20 20 20 20 |Error)..| |
|00000430| 53 79 73 74 65 6d 2e 6f | 75 74 2e 70 72 69 6e 74 |System.o|ut.print|
|00000440| 6c 6e 28 22 46 69 6c 65 | 20 73 75 63 63 65 73 73 |ln("File| success|
|00000450| 66 75 6c 6c 79 20 77 72 | 69 74 74 65 6e 2e 22 29 |fully wr|itten.")|
|00000460| 3b 0d 0a 20 20 20 20 65 | 6c 73 65 0d 0a 20 20 20 |;.. e|lse.. |
|00000470| 20 20 20 20 20 53 79 73 | 74 65 6d 2e 6f 75 74 2e | Sys|tem.out.|
|00000480| 70 72 69 6e 74 6c 6e 28 | 22 41 6e 20 65 72 72 6f |println(|"An erro|
|00000490| 72 20 6f 63 63 75 72 72 | 65 64 20 2d 20 66 69 6c |r occurr|ed - fil|
|000004a0| 65 20 6e 6f 74 20 77 72 | 69 74 74 65 6e 2e 22 29 |e not wr|itten.")|
|000004b0| 3b 0d 0a 20 20 7d 0d 0a | 7d 0d 0a 00 00 00 00 00 |;.. }..|}.......|
|000004c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000004f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000500| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000510| 54 68 69 73 20 72 65 73 | 6f 75 72 63 65 20 66 6f |This res|ource fo|
|00000520| 72 6b 20 69 6e 74 65 6e | 74 69 6f 6e 61 6c 6c 79 |rk inten|tionally|
|00000530| 20 6c 65 66 74 20 62 6c | 61 6e 6b 20 20 20 00 00 | left bl|ank ..|
|00000540| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000550| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000560| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000570| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000580| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000590| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000005f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000600| 00 00 01 00 00 00 01 00 | 00 00 00 00 00 00 00 1e |........|........|
|00000610| 00 00 00 00 00 00 00 00 | 00 1c 00 1e ff ff 00 00 |........|........|
|00000620| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000630| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000640| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000650| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000660| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000670| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+