One, the byte stream FileOutputStream is the direct subclass of the OutputStream FileInputStream is also the direct subclass of InputStream Two, the text file reads and writes 2.1, the byte input streamTest.txt File Contents ABCDEFG PackageCom.pb.io;ImportJava.io.File;ImportJava.io.FileInputStream;Importjava.io.FileNotFoundException;Importjava.io.IOException;/** Fileinputstreamdemo Read file*/ Public classFileInputStreamDemo1 { Public Static voidMain (string[] args) {//1. Declare the file object
abstract class, which is a superclass of all classes that represent the byte input stream. , the basic common function method of byte input stream is defined.
int Read (): reads a byte and returns, no bytes returned -1.
int Read (byte[]): reads a certain amount of bytes and stores it in a byte array, returning the number of bytes read to, no bytes returned -1.
FileInputStream classTo read a file from an input stream
1. Create a subclass object for the byte input stre
system classes)Our program turns out this way:I added a method to read the file in Myutil, which is defined as follows:public static string Getfilecontent (String fileName)He can read the files in the current directory and return the contents of the file based on the file name passed in.We don't care about the implementation, we just need to call it. The Myutil code is as follows:1 Packageutil;2 3 ImportJava.io.*;4 5 Public classMyutil {6 7 Public Static voidprintln (String message)
Vue JS file and then use the Vue object to initialize the application on the line, very simple. But without the build process, it means that we need to write the Vue component with a hard-to-read string template or a more difficult-to-read render function, rather than writing it like Webpack 单文件组件 .This is obviously not tolerated. Written or read Webpack loader students should be clear, loader is actually a function of string processing, not what black technology, the reason Webpack added Vue-l
number of IO to the hard disk access, protect our hard disk. The buffer can be imagined as a small bucket, the data to be read and written into the water, each time the data read or write data before the data is loaded into the bucket, filled with the later to do processing. This is called a buffer. First put the data into the buffer, wait until the buffer is full, once again the buffer in the data written to the hard disk or read out, this can effectively reduce the number of access to the har
* @className Test Exception class7 */8 Public classTest {9 Public Static voidMain (string[] args)throwsfilenotfoundexception,ioexception {Ten Try { One Throw NewException ("This is the declared exception"); A}Catch(Exception e) { - e.printstacktrace (); - } the } - -}3. Exception handling: Try Catch finally or throws catch exception (try Catch finally):The following scenarios occur where the code in the finally is not executed:1) An exception was thro
handling to the following codebyte[] content = null;FileInputStream fis = new FileInputStream("testfis.txt");int bytesAvailabe = fis.available();//获得该文件可用的字节数if(bytesAvailabe>0){ content = new byte[bytesAvailabe];//创建可容纳文件大小的数组 fis.read(content);//将文件内容读入数组}System.out.println(Arrays.toString(content));//打印数组内容6.1 Correct the code and add the following functions. When the file cannot be found, you need to prompt the user not to find the file xxx
) {
Java.io.FileInputStream FIS = null;
try {
FIS = new Java.io.FileInputStream (f);
Fis.read ();
Fis.close ();
catch (Java.io.FileNotFoundException E1) {
System.out.println ("File not Found");
catch (java.io.IOException E2) {
SYSTEM.OUT.PRINTLN ("I/O Exception");
}
If an exception occurs, there is no guarantee that the resource is closed.
}
}
Revised Code:
public class Ciofixed {
public void Method (Java.i
The Lasso tool selects the rock shown in the following figure, and then right-clicks the "through-copy layer".
13, and then adjust the size of the rock, as shown below.
14, select the Big Rock layer, select the menu: Filter > Blur > Gaussian blur, the value of the following figure.
In the filter mask, use a black brush
Here we'll derive json from the JavaScript syntax, and on that basis, how to use JSON on an AJAX application.
In JavaScript everybody knows there's a arrays: an array. Its format is as follows:
Copy Code code as follows:
var Beatles = ["Paul", "John", "George", "Ringo"];
The example above is the form of an array and the following equivalence:
Copy Code code as follows:
var Beatles =new Array ["Paul", "John", "George", "Ringo"];
One more is objects, a
The last 2 months have been doing mobile phone and TV development, the development process encountered a variety of pits. Get fast New Year's day, finally put on the line. 2 months to dry down full of hard work, not so busy with their own preparation of the front-end performance tuning summary below, in order to facilitate the use of their own once again to be handy. Referring to the high-performance website Construction Guide-the essence of front-end engineer skills, this paper mainly summarize
The file class is used to access the properties of files or directoriesFlow: Refers to a series of flowing characters, which is a channel for sending information in FIFO mode. Between the program and the data source is connected by a stream.First set: Byte stream read Write schemeFileInputStream: Byte stream read text file FileInputStream fis=new FileInputStream ("e:\\ read file. txt"); Byte[]bytes=new byte[1024]; int data;
the file class is used to access the properties of files or directoriesFlow: refers to a series of flowing characters, which is a channel for sending information in FIFO mode. Between the program and the data source is connected by a stream.first set: byte stream read Write schemefileinputstream: byte stream read text file FileInputStream fis=New fileinputstream ("e:\\ read file. txt") ; byte []bytes=newbyte[1024x768]; int data;
/*** Copy media files, this example is a copy of the 1.mp3 file, listed in four ways.*/ImportJava.class= "Baidu-highlight" >io. Bufferedinputstream;ImportJava.class= "Baidu-highlight" >io. Bufferedoutputstream;ImportJava.class= "Baidu-highlight" >io. FileInputStream;Importjava.io.FileNotFoundException;ImportJava.io.FileOutputStream;Importjava.io.IOException; Public classBufferedstreamcopyfiles { Public Static voidMain (string[] args)throwsIOException {/*** There are four methods, but it is recom
The key code is as follows: public void Importpostgroupquality () throws Exception {//inputstream fis=new fileinputstream ("e:\\ employee annual assessment. xls"); InputStream Fis=this.path (); Parse out the data of Excel to store the list of the entities//parse out every data in Excel encapsulated entity try {//create Excel workbook Hssfworkbook HWB = new Hssfworkbook (
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.