1, performance: a ". xml" file with an extension2. Storage: Tree-shaped structure3. XML parsing application:Communication between different applications-booking software and payment softwareCommunication between different platforms--operating systemSharing data between different platforms--websites and mobile phones4.The process of reading an XML file in a Java p
One, the configuration file config.properties is placed in the SRC root directory: For example, mine is/propertiestest/src/com/xuliugen/project/type.propertiesThe contents of the configuration file are as follows:left=com.sunny.project.LeftHairright=com.sunny.project.RightHairin=com.sunny.project.InHairRead the code in the configuration file as follows: Public cl
/*A class containing methods useful for manipulatingText Files1. readfilebyline:Reads the contents of a text file line by lineAnd returns a string array representation, whereEach line is stored in an element of the array.2. readfileRead the contents of a text file into a string*/
Import java. Io .*;Import java. util .*
With @propertysource, you can specify the read configuration file and get the value by @value annotations, using: PackageCN.QLQ;ImportOrg.springframework.context.annotation.Bean;ImportOrg.springframework.context.annotation.ComponentScan;Importorg.springframework.context.annotation.Configuration;ImportOrg.springframework.context.annotation.PropertySource; @Configuration//This annotation indicates that the cl
private void FileReader () throws ioexception{BufferedReader bf= New BufferedReader (New InputStreamReader (New FileInputStream ("d:\\comparedll.py"), "UTF-8");String str= "";while ((Str=bf.readline ())!=null) {System.out.println (str);}Bf.close ();}If you do not specify the encoding, the system default encoding is used when reading the file, typically GBKI/O class handling for JavaThe reader class is the parent of the
Using Java code to read the Excel file code times the error is as follows:Jxl.read.biff.BiffException:Unable to recognize OLE streamAt Jxl.read.biff.compoundfile.At Jxl.read.biff.file.At JXL. Workbook.getworkbook (workbook.java:268)At JXL. Workbook.getworkbook (workbook.java:253)At Test1.main (test1.java:25)Cause: Do n
Properties class inherits from HashtableIt provides several main methods:1. GetProperty (String key) that searches for properties in this property list with the specified key. That is, by the parameter key, the value corresponding to the key is obtained.2. Load (InputStream instream) to read the list of attributes (key and element pairs) from the input stream. Gets all the key-value pairs in the file by loa
The method of reading the properties configuration file, often forget, record down memo:Package Utils;Import java.io.IOException;Import Java.io.inputstream;import java.util.Properties; Public classPropertyconfig {Private StaticProperties config; Static{config=NewProperties (); InputStreaminch= Classloader.getsystemresourceasstream ("storm.properties"); Storm.properties stored in the Classpath directory Try{config.load (inch); } Catch(IOExceptio
1. Use the indexof () and substring () provided by the string class to quickly get specific content in a file
public static void Main (string[] args) {
//test where a word appears
String reqmessage = "
This Java implementation of the use of a simple string class to read the contents of a tag in an XML file
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.