Java Common API

Source: Internet
Author: User
Tags spl string format

Common Java API one, Java.io.BufferedReader class (used to read a character from a file; owning kit: java.io) 1, constructor BufferedReader (java.io.FileReader FileReader variable) Description: Creates a new Bufferreader object. 2. Close method void Close () Description: Close the Bufferreader object. 3. ReadLine method java.lang.string ReadLine () Description: Reads a line of characters from a file. If NULL, the delegate reads to the end of the file. Second, Java.io.BufferedWriter (write a character to the file.) Owning kit: java.io) 1, constructor: BufferedWriter (java.io.FileWrite FileWrite variable) Description: Creates a new Bufferwriter object. 2. Close method: void Close () Description: Close the BufferedWriter object. 3. NewLine method: Java.lang.string newLine () Description: Writes a line break to a file. 4. Write method: void Write (char character), void write (char[] character array), void write (string string), void write (char[] character array, start position in int array, int output length Description: Writes data to a file. 5, three, Java.io.File (file for managing files or directories; owning kit: java.io) 1, constructor: File (java.lang.string path, java.lang.string file name) Description: Create a File object that represents the files or directories. 2, CanRead Method: (Boolean CanRead ()) to determine whether to read 3, CanWrite method: (Boolean CanWrite) determine whether you can write 4, CreateNewFile method: (Boolean CreateNewFile ()) Description: Create file, return true successfully, otherwise return FALSE5, Delete method: (Boolean Delete ()) Description: Delete file or directory, return true, otherwise false. 6. Exist method: (Boolean exist ()) Description: Checks whether a file or directory exists. 7. GetName Method: (Java. Lang.string getName ()) Description: Gets the name of the file or directory. 8. LastModified method: (Long LastModified ()) takes out the last modification time. 9, Length method: (int length ()) Description: Get the length of the file 10, Listfiles method: (file[] Listfiles ()) Description: Remove all files in the directory. 11, Isdirectory Method: (Boolean isdirectory ()) Description: Determine whether it is a file. 12, Isfile Method: (Boolean Isfile) Description: Determine whether it is a file. 13. Ishidden Method: (Boolean Ishidden ()) Description: Determines whether the file is hidden. 14, Mk Dir method: (Boolean mkdir) Description: Create a directory, successfully return True, otherwise return false four, Java.io.FileReader (FileReader used to read characters from the file; owning kit: java.io) 1, Constructor (FileReader (Java.lang.strig file path and name) Description: Establishes a FileReader object for the file to be read) 2. Read method: (1) (int read ()) Description: Reads a character from a file, returns a value of one integer, To read the character code of the string and, if the return value is-1, the end of the file has been read. (2) int read (char[] chararray,int startpos,int length) Description: Starts from Startpos, reads the length character, saves to the Chararray array, the return value is the number of words read to, if return-1, Indicates that the end of the file has been read. 3. Skip method: (Long skip (int abbreviated number of characters) Description: Directly the file read pointer to move the number of characters backward, so that the characters do not read); V. Java.io.FileWrite class (used to write read characters to a file; Java.io of the owning kit) 1, FileWrite (java.lang.string file path and name) filwrite (java.lang.string file path and name, Boolean append) Description: Establish a FileReader object for the file to be written, The parameter append indicates whether to add after the original file. 2. Write method: (void Write (char character), char[] number of charactersGroup, string string, char[] character array, start position in int array, int output length) Description: Writes data to a file. The Java.lang.string class (The String class is used to handle the data type of the string; owning kit: Java.lang) 1, Charat method. (Syntax: char charAt (int index) Description: Returns the character at the specified position 2, equals method: (Syntax: Boolean equals (Object AnObject) Description: Determines whether the string is equal to the specified object) case: if ( Str.equals ("abc")) {out.print ("str value is abc");} 3. Index of Method: (Syntax: int indexOf (char ch), int indexOf (string str) Description: Returns the position of the character or substring to find first occurrence in the string, and returns 1 if the character/substring is not found). 4. LastindexOf method (Syntax: int lastindexOf (char ch), int lastindexOf (string ch) Description: Returns the position of the character or substring to look for the last occurrence in the character. If the character/substring is not found, return-1) 5, replace method: (Syntax: string replace (char Oldchar,char Newchar) Description: Replaces a character in a string, the return value is the substituted result. ) 6, Substring Method: (Method: String substring (int beginindex); string substring (int beginindex,int endIndex) Description: Gets the substring in the string. Example: String a= "AABB"; b=a.substring (1) The final result is "ABB" c=a,subsirng, the final result is "AB" 7, the case of the conversion method (syntax: string toLowerCase (); String toUpperCase () Description: Case conversion of a string, return value is converted result) 8, ValueOf Method (Syntax: String valueOf (Object obj) Description: Convert the object to a string, return value is the converted result) Vii. Java.net.URL Encoder (Description: Urlencoder class is used for URL encoding. Owning kit: JAVA. net) 1, EncoThe De method (syntax: java.lang.string encode (java.lang.sring string to encode) Description: Returns the encoded string. ) Viii. Java.text.simpleDateFormat Class (Description: The SimpleDateFormat class is used to process the formatted output and input of the date data. Belongs to Kit: Java.text) 1, constructor: (Syntax: SimpleDateFormat (JAVA.LANG.STRNG formatted string) Description: Generate SimpleDateFormat object according to specified format string) 2, Format method: (Syntax: java.lang.string format (java.util.Date date data) Description: Converts the date data to a string of the specified format. 3. Parse Method: (Syntax: Java.util.Date parse (java.lang.sring string) Description: Converts a string to Date data. If the format is incorrect, an exception will be generated. Ix. Java.spl.DriverManager Class (description: When the database driver is loaded into memory, the system automatically registers the loaded driver with the DriverManager class so that its status is available (available) belongs to the bundle: JAVA.SPL1 , getconnection Method: (Syntax: getconnection (String data source name, string user name, string user password) Description: Open the database link. ) X. Java.sql.connection Class (Description: The connection class is used to process a link to a database. Owning kit: java.sql) 1, createstatement Method: (Syntax: java.spl.statement createstatement (int pointer type parameter, int data consistency parameter) Description: Establishes the statement object. Xi. Java.sql.ResultSetMetaData Class (Description: The ResultSetMetaData class is used to obtain information about the recordset field. Owning kit: JAVA.SQL.1, getColumnCount Method: (Syntax: int getcolumncount () Description: Gets the number of fields in the Recordset) 2, getColumnName Method: (Syntax: java.lang.String getColumnName (int column) Description: Gets the word name of the field. Where the field index value is a recordThe index value of the field in the recordset, the index value of the first field is 1, and the index value of the last field is the total number of fields. 12, Java.sql.Statement Class (Description: Statement class can execute SQL actions and query statements, to achieve the operation of the database. Belongs to Kit: java.sql). 1. Execute method: (Syntax: boolean execute (String sql) Description: Execute SQL action statements, such as INSERT, delete, modify, and so on. Example: St.execute ("delect from Table")//delete data from table tables. 2, ExecuteQuery Method: (Syntax: Java.sql.ResultSet executeQuery (String sql) Description: Execute SQL query statement, get the corresponding recordset. Example: Rs=st.execute ("SELECT * FROM table")//Extract data from the table. 13, Java.sql.ResultSet Class (Description: The ResultSet class is used to process a recordset. Owning kit: java.sql) 1, Absolute Method (Syntax: boolean absolute (int row) Description: Sets the location where the record pointer points to the record. ) 2, Afterlast Method: (Syntax: void Afterlast () Description: Moves the pointer after the last record. ) 3, Beforefirst () Method: (Syntax: void Beforefirst () Description: Moves the pointer before the first record. ) 4, first method: (Syntax: Boolean one () Description: Moves the record pointer to record one. ) 5, Isafterlast Method: (Syntax: Boolean isafterlast () Description: Determine if the record pointer is pointing to the last record) 6, Isbeforefirst Method: (Syntax: Boolean isbeforefirst () Description: Determines whether the record pointer points before the first record. 7, IsFirst Method: (Syntax: Boolean isFirst () Description: Determine if the pointer is pointing to the first record) 8, Islast Method: (Syntax: Boolean islast () Description: Determine the record refers to?

  

Java Common API

Related Article

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.