3rd Chapter input and output

Source: Internet
Author: User

3.1 Bufferedinputstream Class--buffered byte input stream 125


Construction method of--bufferedinputstream class for 3.1.1 Construction method 125
3.1.2 Available Method--Returns the estimated number of bytes that can be read 125
3.1.3 Close Method--closes this input stream and frees all associated system resources 126
3.1.4 Mark Method--record where the current pointer is located 126
3.1.5 Marksupported Method--Test whether the mark () method and Reset () method 127 are supported
3.1.6 Read Method--reading data from the input stream 128
3.1.7 Reset Method--reposition input stream 129
3.1.8 Skip Method-skips and discards data of the specified number of bytes 129
3.2 Bufferedoutputstream Class--buffered byte output stream 130
Construction method of--bufferedoutputstream class for 3.2.1 Construction method 130
3.2.2 Flush Method-refreshes this buffered output stream 131
3.2.3 Write Method--writes data to the output stream 131
3.3 BufferedReader Class--buffered character input stream 133
Construction method of--bufferedreader class for 3.3.1 construction method 133
3.3.2 Close Method--closes the stream and frees all resources associated with it 133
3.3.3 Mark Method--record where the current reading pointer is located 134
3.3.4 Marksupported Method--Determines whether the specified stream supports the mark () Operation 134
3.3.5 Read Method--reads the characters from the buffered input stream 135
3.3.6 ReadLine Method--reading a line of text 136
3.3.7 Ready Method--determine if this stream is prepared to be read 137
3.3.8 Reset Method--Reposition pointer 137
3.3.9 Skip Method-Skips a specified number of characters 138


3.4 BufferedWriter Class--buffered character output stream 138


Construction method of--bufferedwriter class for 3.4.1 construction method 139
3.4.2 Close Method--close stream 139
3.4.3 Flush Method--Flush buffer 139
3.4.4 NewLine Method--write a row delimiter 140
3.4.5 Write Method--writes data to the buffer 141


3.5 DataInputStream Class--Data input stream 142


3.5.1 Read Method--Reads a certain number of bytes 143
3.5.2 ReadByte Method--Read Byte 145 required for this operation
3.5.3 Readboolean Method--Reads a Boolean value 145
3.5.4 Readchar Method--read the characters required for this operation 145
3.5.5 Readdouble Method--Reads a double value of 146
3.5.6 Readfloat Method--Reads a float value of 146
3.5.7 Readfully Method--read some bytes 147
3.5.8 Readint Method--Reads an int value of 148
3.5.9 Readlong Method--Reads a Long value of 149
3.5.10 Readshort Method--Reads a short value of 149
3.5.11 Readunsignedbyte Method--Read unsigned byte value 149
3.5.12 Readunsignedshort Method--read unsigned short value 150
3.5.13 readUTF Method--Reads the UTF-8 encoded string 150
3.5.14 Skipbytes Method--skips n bytes of data in an input stream 152


3.6 DataOutputStream Class--Data output stream 153


3.6.1 Flush Method--empty this data output stream 153
3.6.2 Size Method--Returns the current value of counter written 154
3.6.3 Write Method (Stream output method) 155
3.6.4 Writeboolean Method-Writes a Boolean value to the output stream 156
3.6.5 WriteByte Method-Writes a byte value to the output stream 156
3.6.6 Writebytes Method-Writes the low-byte contents of each character in a string to the output stream 157
3.6.7 Writechar Method-Writes a char value to the output stream 157
3.6.8 WriteChars Method-Writes the string each char value to the output stream 158
3.6.9 Writedouble Method-Writes a double value to the output stream 158
3.6.10 Writefloat Method--Writes the float value to the output stream 159
3.6.11 Writelong Method-Writes a long value to the output stream 160
3.6.12 Writeshort Method-Writes a short value to the output stream 160
3.6.13 writeUTF () Method--writes UTF-8 encoded characters to the output stream 161


3.7 File Class--Files class 161


Construction method of--file class for 3.7.1 construction method 161
3.7.2 constant of--file class 162
3.7.3 CanExecute Method--Interpreting whether a file is executable 162
3.7.4 CanRead Method--Determine if the file is readable 162
3.7.5 CanWrite Method--Determine if the file can be written 163
3.7.6 CompareTo Method--Compare File Object 163
3.7.7 CreateNewFile Method--Create a new file 164
3.7.8 Createtempfile Method--Create temporary file 164
3.7.9 Delete Method--Deleting a file 167
3.7.10 Deleteonexit Method--Request to delete a file when the virtual machine terminates 167
3.7.11 Equals Method--determine if the file object is equal 168
3.7.12 exists Method--determine if the file exists 168
3.7.13 Getabsolutefile Method--Gets the absolute path of the file object 169
3.7.14 GetAbsolutePath Method--Gets the absolute path of the string object 169
3.7.15 Getcanonicalfile Method-Returns the canonical form of this abstract path name 170
3.7.16 Getcanonicalpath Method--Returns the canonical pathname string for this abstract path name 170
3.7.17 Getfreespace Method--Get the remaining space 171
3.7.18 GetName Method--Get file name 172
3.7.19 GetParent Method--Gets the string of the upper-level path 172
3.7.20 Getparentfile Method--Get the file object of the previous level path 173
3.7.21 GetPath Method--Get path string 173
3.7.22 Gettotalspace Method--Get total space size 173
3.7.23 Getusablespace Method--accurate acquisition of writable space size 174
3.7.24 Hashcode Method-generates a hash code for the file object 174
3.7.25 Isabsolute Method--Test whether this pathname is an absolute pathname 175
3.7.26 Isdirectory Method--Determine if the file object is a directory 175
3.7.27 Isfile Method--Determine if the file object is a document 176
3.7.28 Ishidden Method--Determining whether a file object sets a hidden property 176
3.7.29 LastModified Method--Get last modified 177
3.7.30 Length Method--Get file Lengths 177
3.7.31 List Method--Get a string array of directory listings 178
3.7.32 Listfiles Method--Get the file array of directory list 179
3.7.33 Listroots Method--Get the file array of the root directory 181
3.7.34 MkDir Method--Creating a directory 182
3.7.35 Mkdirs Method--Create full path for all directories 183
3.7.36 Renameto Method--Renaming a file or folder 183
3.7.37 Setexecutable Method--Setting the executable property 184
3.7.38 Setlastmodified Method--Set last modified 185
3.7.39 Setreadable Method--Setting the readable attribute 185
3.7.40 Setreadonly Method--Set read-only property 187
3.7.41 Setwritable Method--Setting writable properties 187
3.7.42 tostring Method--file string Format 188
3.7.43 Touri Method--Get the URI of file 189


3.8 FileInputStream Class--file byte input stream 189


Construction method of--fileinputstream class for 3.8.1 construction method 189
3.8.2 Available Method--get a readable number of valid bytes 189
3.8.3 Close Method--closing the file input stream 190
3.8.4 Finalize Method-closes the input stream when destroying an object 191
3.8.5 Getchannel Method--Returns the only FileChannel object associated with this file input stream 191
3.8.6 getFD Method--Gets the FileDescriptor object connected to the file object 191
3.8.7 Read Method--reading an array from a file byte stream 192
3.8.8 Skip Method--skips and discards n bytes 193


3.9 FileOutputStream Class--file byte output stream 194


Construction method of--fileoutputstream class for 3.9.1 construction method 194
3.9.2 Close Method--Closes the file output stream and frees up resources 195
3.9.3 Finalize Method--turn off output stream when stream is destroyed 195
3.9.4 Getchannel Method--Gets the FileChannel object of the output stream 195
3.9.5 getFD Method--Gets the FileDescriptor object connected to the file object 196
3.9.6 Write Method--writes data to the file output stream 196


3.10 FileReader Class--character input stream of a file 199


Construction method of--filereader class for 3.10.1 construction method 199
3.10.2 Close Method--close character input stream 200
3.10.3 Read Method--reading character data 200


3.11 FileWriter Class--character output stream of the file 202


Construction method of--filewriter class for 3.11.1 construction method 202
3.11.2 Close Method--close character output stream 202
3.11.3 Flush Method--Flush Buffer 203
3.11.4 Write Method-writes data to a character output stream 203


3.12 InputStream Class--byte input stream 205


3.12.1 available Method--Get a valid number of readable bytes 205
3.12.2 Close Method--close input stream 206
3.12.3 Mark Method--mark the current position in this input stream 206
3.12.4 marksupported Method--determining whether to support mark and reset method 207
3.12.5 Read Method--reads data from a byte input stream 207
3.12.6 Reset Method-Position 209 when repositioning to the last mark () method
3.12.7 Skip Method--skips and discards n bytes 209


3.13 OutputStream Class--byte output stream 210


3.13.1 Close Method--close byte output stream 210
3.13.2 Flush Method--Flush Buffer 211
3.13.3 Write Method-writes data to the output stream 211


3.14 ObjectOutputStream Class--Object output stream 213


Construction method of--objectoutputstream class for 3.14.1 construction method 213
3.14.2 Close Method--close object output stream 213
3.14.3 Flush Method--Flush Buffer 214
3.14.4 WriteObject Method-Writes an object to the output stream 214
3.14.5 Writebytes Method--writing a string to the output stream 215
3.14.6 Write Method-writes a byte value to the output stream 215
3.14.7 Writechar Method-Writes a char value 216 to the output stream
3.14.8 WriteChars Method-Writes a string value to the output stream 217
3.14.9 Writedouble Method-Writes a double value 217 to the output stream
3.14.10 Writefields Method--Writes a buffered field to the stream 217
3.14.11 Writefloat Method-Writes a float value to the output stream 218
3.14.12 Writeint Method-writes an int value to the output stream 218
3.14.13 Writelong Method-Writes a long value to the output stream 219
3.14.14 Writeshort Method-Writes a short value to the output stream 219
3.14.15 writeUTF Method-Writes a float value to the output stream 219


3.15 ObjectInputStream Class--Object input stream 220


Construction method of--objectinputstream class for 3.15.1 construction method 220
3.15.2 ReadObject Method--Reading an object from an input stream 220
3.15.3 Readint Method--reading an int value from an input stream 221
3.15.4 Readfloat Method--Reads float value from input stream 221
3.15.5 Readchar Method-Reads a char value from the input stream 222


3.16 Randomaccessfile Class--Random file Access Class 222


Construction method of--randomaccessfile class for 3.16.1 construction method 222
3.16.2 Close Method--Turn off data flow 222
3.16.3 Getchannel Method--Returns the FileChannel object of this file 223
3.16.4 getFD Method--Returns the opaque file descriptor object for this stream 223
3.16.5 Getfilepointer Method--Returns the current offset in the file 224
3.16.6 Length Method--Returns the duration of this file 224
3.16.7 Read Method--Reads a data byte 225
3.16.8 Readboolean Method--Reads a Boolean value from a file 227
3.16.9 ReadByte Method--Reads a byte value from a file 228
3.16.10 Readint Method--Reads an int value from a file 228
3.16.11 Readchar Method--Reads a char value from a file 229
3.16.12 Readdouble Method--Reads a double value from a file 229
3.16.13 Readfloat Method--Reads a float value from a file 230
3.16.14 Readfully Method--Reads a byte array from a file 230
3.16.15 ReadLine Method--Reads the next line of text from this file 232
3.16.16 Readlong Method--Reads a long value from a file 232
3.16.17 Readshort Method--Reads a short value from a file 233
3.16.18 Readunsignedbyte Method-Read unsigned byte value from file 234
3.16.19 Readunsignedshort Method--read unsigned short value from file 234
3.16.20 readUTF Method-Reads a UTF-8 string from this file 235
3.16.21 SetLength Method--Set the length of this file 235
3.16.22 Seek Method--Move the file pointer to the specified position 236
3.16.23 Skipbytes Method--Skip and discard n bytes 236
3.16.24 Write Method-writes the specified byte 237 to this file
3.16.25 Writeboolean Method--Writes a Boolean to the file 239
3.16.26 WriteByte Method-Writes a byte to the file 239
3.16.27 Writebytes Method--Writes the string to the file by byte sequence 240
3.16.28 WriteChars Method--Writes a string as character data 240
3.16.29 Writedouble Method--write Double value 241
3.16.30 Writefloat Method--Write to file float value 241
3.16.31 Writeint Method-Write int value to file 242
3.16.32 Writelong Method-Writes a long value to a file 242
3.16.33 Writeshort Method--Writes a short value of 243 to a file
3.16.34 writeUTF Method--writing a UTF-8 encoded string to a file 243


3.17 Reader Class--abstract class for reading stream of characters 244


3.17.1 Close Method--close stream 244
3.17.2 Mark Method--marks the current position in the stream 244
3.17.3 marksupported Method--determine if the mark () operation is supported 245
3.17.4 Read Method--reading data from a stream 245
3.17.5 Ready Method--determining whether to read this stream 247
3.17.6 Reset Method--Reset the stream 248
3.17.7 Skip Method--skips and discards n bytes 248


3.18 Scanner Class--Simple text scanner 249


Construction method of--scanner class for 3.18.1 construction method 249
3.18.2 Close Method--close the scanner 250
3.18.3 Delimiter Method--Returns the Pattern 250 that matches the delimiter
3.18.4 Findinline Method--Ignore delimiter to find the next construction mode 250
3.18.5 Findwithinhorizon Method--try to find the next specified pattern 251
3.18.6 Hasnext Method--whether there is another marker in the input of the scanner 252
3.18.7 Hasnextbigdecimal Method--whether the next token is a BigDecimal in the default cardinality 254
3.18.8 Hasnextbiginteger Method--whether the next token is a BigInteger in the default cardinality 254
3.18.9 Hasnextboolean Method--whether the next token is a Boolean value 255
3.18.10 Hasnextbyte Method--whether the next token is a byte value 256
3.18.11 Hasnextdouble Method--whether the next token is a double value 256
3.18.12 Hasnextfloat Method--whether the next tag is a float value of 257
3.18.13 Hasnextint Method--whether the next tag is an int value 257
3.18.14 Hasnextline Method--whether the next line exists 258
3.18.15 Hasnextlong Method--whether the next token is a Long value 259
3.18.16 Hasnextshort Method--whether the next token is a short value of 260
3.18.17 IOException Method--the last thrown IOException 260
3.18.18 Locale Method-Returns the locale of this scanner 261
3.18.19 Match Method--matching result of the last scan operation 261
3.18.20 Next Method--read the next full tag 262
3.18.21 Nextbigdecimal Method--Reads the next BigDecimal object 263
3.18.22 Nextbiginteger Method--Reads the next BigInteger object 264
3.18.23 Nextboolean Method--Reads the next Boolean value 265
3.18.24 Nextbyte Method--Reads the next byte value 266
3.18.25 Nextdouble Method--Reads the next double value 267
3.18.26 Nextfloat Method--Reads the next float value 267
3.18.27 Nextint Method--Reads the next int value 268
3.18.28 Nextline Method--Reads the next line of text 269
3.18.29 Nextlong Method--Reads the next Long value 269
3.18.30 Nextshort Method--Reads the next short value 270
3.18.31 Radix Method--Returns the default cardinality of the scanner 271
3.18.32 Reset Method--Reset Scanner 271
3.18.33 Skip Method--Ignore delimiter skip matching input information 272
3.18.34 ToString Method--Returns the string representation of this Scanner 273
3.18.35 Usedelimiter Method--set to specify delimited mode 273
3.18.36 Uselocale Method--set to the specified locale 274
3.18.37 Useradix Method--setting the specified cardinality 274


3.19 Writer class--abstract class for writing stream of characters 275


3.19.1 Append Method--Add the specified character 275
3.19.2 Close Method--Turn off data flow 275
3.19.3 Flush Method--refreshes the buffer of the stream 276
3.19.4 Write Method-writes data to the character output stream 276

3rd Chapter input and output

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.