Discover read file into arraylist java, include the articles, news, trends, analysis and practical advice about read file into arraylist java on alibabacloud.com
error occurs, or the end of the stream has been reached.
Parameters:
cbuf-Target Buffer
Return:
The number of characters read, or 1 if the end of the stream has been reached
Thrown:
IOException -If an I/O error occurs
first read the con
. To search for GetProperty (String key).3. SetProperty (String key,string value), invoke the Hashtable method put. He sets the value key-value pair by calling the base class's put method.4. Store (OutputStream out,string comments) to write the list of properties in this properties table (key and element pairs) to the output stream in a format suitable for loading into the properties table using the Load method. In contrast to the load method, this method writes a key-value pair to the specified
/** Read the configuration file under Java engineering steps* 1. Rt.jar--Java.util-Resourcebundle.class* 2. The configuration file suffix name must be. Properties, and the content must be a key-value pair* Key1=value1* Key2=value2* ...* 2. Test.properties configuration file
file (memory)--Input stream--> "program"--Output stream-->file (memory)
When we read and write text files, it is very convenient to use reader, such as Filereader,inputstreamreader and BufferedReader. One of the most important classes is InputStreamReader, which is a bridge between bytes converted to characters. You can specify the encoding in the constructor,
(")"));//Intercept to a numberI=integer.parseint (NUMSTR);//To calculate the number of the interceptionNewstr=i.tostring (); S=s.replaceall (Numstr, NEWSTR);//Replace the original number with the calculated numberResult.append (System.getproperty ("line.separator") +s); Sc.write (System.getproperty ("Line.separator") +s); } Else{result.append (System.getproperty ("Line.separator") +s); Sc.write (System.getproperty ("Line.separator") +s); }} br.close (); Sc.close
A text file created under Windows with a text editor that, if saved in Unicode format such as UTF-8, adds a BOM ID to the file header (the first character).This identifier is not removed when Java reads the file, and String.Trim () cannot be deleted. If you use ReadLine () to read
/* The first demonstration method for File Reading */import Java. io. *; // import the IO package class filereaderdemo1 {public static void main (string [] ARGs) throws ioexception // an exception is thrown here {// upload a file to read the stream object, is associated with the fi
This tool class is convenient for configuring file reads in Java Projects ~ Example code: PackageCom.lky.util;ImportJava.io.BufferedReader;Importjava.io.IOException;ImportJava.io.InputStream;ImportJava.io.InputStreamReader;Importjava.util.Properties;ImportOrg.apache.commons.logging.Log;Importorg.apache.commons.logging.LogFactory;/*** @ClassName: readconfigutil* @Description:
Tag: Direct user value substr Manager int IMP RedWrote a batch of Lua script, to put in the database, the call when the calculation, because there are too many Lua script, wrote a program to input. The following are mainly divided into three parts: Public Static string readtostring (String fileName)
Public Static void throws FileNotFoundException
Public Static List Readtostring, which is used to read a script from a LUA script, which is a
File class:RenametoDeleteListListfilesFilenameFilter Flow: A conduit for data communicationFlow of data: file, memory, networkClassification of streams:1. Direction2. Units3. function Common streams:Node Flow:1, File Stream (FILEXXX): Manipulate the flow of files, data stored in the file2. Memory Stream (BYTEARRAYXXX): Flow of operating memory, data stored in me
When Java reads a string from a byte stream, it converts platform-related bytes into platform-independent Unicode strings. During output, Java will convert the Unicode string to the byte stream related to the platform. If a Unicode character does not exist on a platform, ′? ′. For example, in Japanese windows, Java reads a "shift_jis" encoded
1.JAVA Properties class, in the Java.util package, the specific class is java.util.properties.The properties class inherits from the Hashtable class and implements the map interface, and it also holds the property set in the form of a key-value pair. However, the properties have a special place, that is, its keys and values are string types.The 2.properties class is a collection class that fills KeyValue key-value pairs. Loads the information in the.
Java sequential Read and write Properties configuration file support Chinese not garbledJava sequential read and write properties configuration file, Java default provides the properties API inherit HashMap, not sequential
above manner, and subsequent reads are read in the cache, and if the configuration is modified during this period, it cannot be synchronized in real time.ResourceBundle has two subclasses listresourcebundle and propertyResourceBundle, which are actually handled using propertyResourceBundle when reading the properties file.Off Topic:ResourceBundle is primarily used to address internationalization and localization issues. The information for each langu
When we use MyBatis to operate the underlying database, we need to use the XML configuration file, generally we put the configuration file and DAO in the same directory.However, when using idea to manipulate the MAVEN project, we may encounter a mapper.xml file that cannot be read to the DAO.The simple solution is as f
Java read files can be used with byte stream and character stream. Since a Chinese character accounts for two bytes, if there is a Chinese character in the configuration file, it will be garbled if it is read with a byte stream. Character streams are not garbled.The configuration f
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.