.


:




:

































 

 

 

 


- Java.




, , - /. Java java.io (input/output). / , . , , . (, HTML ), ( ). . Java / (stream). , . , - , - () . stream , , /.

Java . java.io. . - , .

. "" , , , 0 1 ( , ; , 1 , 0 - ). , 8 . , , 1 , 0 28-1=255, , , -128 +127. byte Java , . , . , java.io , .

, .

InputStream - , .. . , . , InputStream.

OutputStream - .

Java /, java.io. .

File. . 3 , : File(String _) - ''

I. 5 :

FileInputStream ( InputStream)- () . File , , FileInputStream myfile = new FileInputStream("data.txt"); - read() ; read(byte [] ) - . close, InputStream.

FileOutputStream ( OutputStream) - () . File , , FileOutputStream myfile = new FileOutputStream("data.txt"); : write(int ) - ; write(byte [] ) - . close, OutputStream.

DataInputStream ( InputStream) - () . InputStream, .., , DataInputStream myfile = new DataInputStream(new FileInputStream("data.txt")); : readInt(), readFloat(), readChar() .. - .

DataOutputStream ( OutputStream) - () . OutputStream, .., , DataOutputStream myfile = new DataOutputStream(new FileOutputStream("data.txt")); : writeInt(int ), writeFloat(float ), writeChar(char ), writeChars(String ) .. - .

RandomAccessFile - , , . c File . : readInt(), readFloat(), readChar() .. - ; writeInt(int ), writeFloat(float ),writeChar(char ),writeChars(String ) .. - .

II. 6 .

InputStreamReader OutputStreamWriter ( Reader Writer) - / / . InputStream OutputStream. ,

InputStreamReader myfile = new InputStreamReader(new FileInputStream("data.txt"));OutputStreamWriter myfile = new OutputStreamWriter(new FileOutputStream("data.txt"));

getEncoding (cp1251 - Windows), , . read write / ( ).

FileReader FileWriter ( InputStreamWriter OutputStreamWriter) - InputStreamWriter OutputStreamWriter , c File , ..

FileReader myfile = new FileReader("data.txt");FileWriter myfile = new FileWriter("data.txt");

.

BufferedReader BufferedWriter ( Reader Writer) - - , , , , FileReader FileWriter. Reader Writer, ,

BufferedReader myfile = new BufferedReader (new FileReader("data.txt"));BufferedWriter myfile = new BufferedWriter (new FileWriter("data.txt"));

BufferedReader readLine(), .

 





:


: 2016-10-06; !; : 591 |


:

:

, , .
==> ...

1910 - | 1554 -


© 2015-2024 lektsii.org - -

: 0.014 .