= Fileusername.getbytes ();
byte[] Bytepassword = Filepassword.getbytes ();
Fileoutputstream.write (Byteusername);
Fileoutputstream.write (Bytepassword);
LOG.V ("FileInputStream Save Result", "UserName =" + Fileusername + "Password =" + Filepassword); Fileoutputstream.flush();
Fileoutputstream.close ();
catch (Exception e) {e.printstacktrace ();}} Reading a file reads the contents of the entire file.
If you want to add a resolution, save it in a spec
This article is based on Linux environment operation, readers need to have a certain knowledge of Linux before readingThe InputStream consists of three methods as follows:
int read (): reads a single byte from the input stream, returning the byte data read (byte data can be converted directly to int type)
int read (byte[] b): reads up to b.length bytes of data from the input stream and stores it in byte array B, returning the actual number of bytes read
int read (byte[] b, int o
File, fileinputstream, filereader, inputstreamreader, bufferedreader...
References:
L Chapter 12 of core Java
L detailed description of how to operate text files using Java
Http://java.ccidnet.com/art/3737/20041108/523627_1.html
L what is filereader class? What is the difference with fileinputstream ???
Http://book.hackbase.com/ask2/ask107572.htmOrganize and comprehend by yourself:Introduction:C language on
Use and difference of fileinputstream, filereader, inputstreamreader file, fileinputstream, filereader, inputstreamreader, and bufferedreaderReferences:Chapter 12 of core JavaDetailed description of http://java.ccidnet.com/art/3737/20041108/523627_1.html using Java to operate text filesWhat is filereader class? What is the difference with fileinputstream ???Http:
This chapter describes FileInputStream and FileOutputStream
Introduction to FileInputStream and FileOutputStream
FileInputStream is the file input stream, which inherits from InputStream.
Typically, we use FileInputStream to get input bytes from a file.
FileOutputStream is the file output stream, which inherits fro
Transferred from: Http://hi.baidu.com/danghj/item/0ef2e2c4ab95af7489ad9e39Resources:L "Core Java" chapter 12L How to manipulate text files using Java http://java.ccidnet.com/art/3737/20041108/523627_1.htmlWhat kind of FileReader is L? What's the difference with FileInputStream? Http://book.hackbase.com/ask2/ask107572.htmSelf-collation and understanding:Introduction:C language only needs a file*, and unlike C, Java has a series of flow types, the numb
InputStream objects created with the FileInputStream class can be used to read content from a file. The two commonly used constructors are as follows: FileInputStream (String FilePath) FileInputStream (File fileobj) Both constructors will throw filenotfoundexception exceptions. Where FilePath is the full pathname of the file, and Fileobj is the file object that
what is InputStream and OutputStream.
InputStream and OutputStream are abstract classes that are the parent class for all byte input and output streams. Here, we first need to clarify two concepts: InputStream (Input stream): the input stream is used to read data. --> > > Read outputstream (Output stream): Output stream is used to write data. --> > > Write file input stream--fileinputstream
FileInputStream
Differences between fileinputstream and filereader
Core tips: 1) File class introduction File class encapsulates the function of operating the file system on the user's machine. For example, you can use the File class to obtain the last modification time, move the object, or delete or rename the object. In other words, the stream class focuses on the file content, while the file class focuses on the main methods for storing files on disks: (), Last
I. How to read and write files
reads a file through a stream. A stream is a series of flowing characters that send an information channel in a first-in, first-out manner.
ii. Classification of Java streams
to divide by the flow direction
1. Output stream OutputStream and writer as base class
2. Input stream InputStream and reader as base class
input and output are relative to computer memory.
divided by processing data units
1, Byte stream
⑴ byte input stream, InputStream base class;
Before explaining the specifics of FileInputStream and FileReader in Java, I want to talk about the fundamental differences between InputStream and Reader in Java, and when to use InputStream and reader respectively. In fact, InputStream and reader are abstract classes and do not directly read data from a file or socket. However, the main difference between them is that InputStream is used to read binary data (Byte stream mode, translator note), reade
Read and write to the file is always my weak link, this is caused by the wrong learning habits: each course I began to learn very seriously, so the foundation is relatively solid point; but then the more the more relaxed, so the next one becomes blurred, and the Java curriculum I/O Also put in the back position to introduce, so this piece of learning is not good ...
This morning I was looking at "Ivor Horton's beginning Java 2, JDK 5 Edition" ("Java 2 Getting Started"), and wrote several example
Preface:For files in the file system, you can use the FileInputStream stream class to read in binary form, but because Java itself is positioned above the JVM, it does not have the ability to handle the underlying computer, Therefore, some of the methods involved in the underlying processing are processed using the native method to invoke the third-party underlying language.I re-explain the internal implementation of the
java.io There are two abstract classes: InputStream and ReaderInputStream is a superclass of all classes that represent byte input streamsReader is an abstract class for reading stream of charactersThe InputStream provides a byte stream reading, not a text read, which is fundamentally different from the reader class.That is, read by reader is a char array or string, using InputStream to read a byte array.Figure out the fundamental differences between the two superclass, and then look at the use
FileInputStream and Android database tools for android Data Storage
Three typical local data storage methods for Android
Import android. content. Context;Import android. util. Log;Import java. io. FileInputStream;Import java. io. FileOutputStream;/*** Created by zhizhao on 0001 in.*/Public class UsingFileInputStream {Private Context fileContext;Private String fileName;Private String fileUse
Ava.io There are two abstract classes: InputStream and ReaderInputStream is a superclass of all classes that represent byte input streamsReader is an abstract class for reading stream of charactersThe InputStream provides a byte stream reading, not a text read, which is fundamentally different from the reader class.A char array or string that is read by reader, the byte array is read with InputStream.Figure out the fundamental differences between the two superclass, and then look at the use of s
The difference between the FileInputStream class and the FileReader class:The form and parameters of the constructors for two classes are the same, the arguments are file objects, or the string that represents the path, what is the difference between them?? Readers and writers work is only on line based character data, so plain text files.For anything else, you must use Streams.? JDK5 API:FileInputStream is meant for reading streams of raw bytes such
-----------------------------------------------------------------------------------FileInputStreamclass declaration: PublicClass FileInputStream extends InputStreamLocated under the Java.io packageThe official notes to it:A fileinputstream obtains input bytes from a file in a file system. What files is available depends on the host environment.(Simple translation: FileI
java io Stream is the input and output stream, the stream is a set of sequential, with the beginning and end of the byte combination, is the general name of the data transmission. That is, the transmission of data between two devices is called a stream, and the nature of the flow is data transmission. the IO stream can be divided into byte stream and character stream. Give the corresponding IO structure diagram:in the next period of time, will slowly introduce the use of various streams, this bl
format to pass in the InputStream objectThere are two ways to define a InputStream object. System.in or FileInputStream objectsystem.in: Read input from consoleFileInputStream: Can be instantiated by file path name PathnameInputStreamReader inputstreamreader1=New InputStreamReader (system.in); InputStreamReader Inputstreamreader2=new inputstreamreader (new FileInputStream ("/opt/xxx")); Nputstreamreader I
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.