I. binaryreader. H is defined as follows:
# Ifndef linyanwenbinaryreader_h _# Define linyanwenbinaryreader_h _
# Include "poco/textconverter. H"# Include "poco/Foundation. H"# Include # Include Namespace linyanwen {Class textencoding;Class binaryreader/// This class reads basic types (and STD: vectors thereof)/// In binary form into an input stream./// It provides an extractor-based interface similar to ist
encoding.StreamWriter classImplements a TextWriter that writes characters to a stream in a specific encodingTextReader classRepresents a reader that can read a series of contiguous characters.TextWriter classRepresents a writer that can write an ordered series of characters. The class is an abstract class.BinaryReader classReads the primitive data type as a binary value with a specific encoding. You can think of BinaryReader as an extension to Stream
C # 's FileStream class provides the most primitive byte-level file read and write functionality, but we are accustomed to manipulating strings, so the StreamWriter and StreamReader classes enhance the FileStream, which lets us manipulate files at the string level, But sometimes we still need to manipulate the file at the byte level, but not a byte-by-bit operation, usually 2, 4, or 8 bytes, which has the BinaryWriter and BinaryReader classes, which c
He looked at binarywriter/binaryreader and tried it. He was impressed by the fact that he had been studying it for several days. By the way, he made a summary:
Concept of three-tier architecture
User Interface presentation layer (USL/UI) business logic layer (BLL) data access layer (DAL)
Role of each layer
1. Data access layer: it is the operation layer for raw data (in the form of database or text files). It provides data services for the business lo
// Create two filestream objectsFilestream fsof = new filestream (originfile, filemode. Open, fileaccess. Read );Filestream fsnf = new filestream (newfile, filemode. Create, fileaccess. Write );
// Create a read/write classBinaryreader BR = new binaryreader (fsof );Binarywriter BW = new binarywriter (fsnf );
// Point the Read File stream pointer to the stream HeaderBR. basestream. Seek (0, seekorigin. Begin );// Point the written file stream pointer
the stream in a specific encoding.
TextreaderClass
The reader that can read the continuous character series.
TextwriterClass
Indicates that an ordered character series writer can be compiled. This class is an abstract class.
BinaryreaderClass
The base metadata type is read as a binary value using a specific encoding.
Binarywriter
Writes the primitive type to the stream in binary format, and supports writing strings with specific encoding.
The binarywriter and
having to know the details of the operating system and basic devices. We hope the example in this article can help you understand the usage of the stream.
Next we will study the reading members of the stream class and its derived classes.
Stream. Read ()
Stream. readbytes ()
Binaryreader. Read ()
Binaryreader. readbytes ()
Textreader. Read ()
Textreader. readblock ()
The stream. Read method
Folder is different than the input file then pass it, otherwise chunk files will be created in''Same folder.''Chunk File Size shocould be less than the input file size.''Client application is informed via the FileSplitCompleted event''Ss SS can be updated via UpdateProgress eventDim _ FileSize As LongDim _ Index As ShortDim _ OutputFile As StringDim _ BaseName As StringDim _ StartPosition As LongDim _ Buffer As Byte () = New Byte (){}Dim _ InputFileStram As System. IO. FileStreamDim _ OutputFil
object is then used to get other more convenient objects, such as BinaryReader objects, binarywrite objects, to prepare for further communication with the other. 3. Each get a new TcpClient object, create a thread that corresponds to the customer, and the threads communicate with the corresponding customer. 4. Determine whether to close the connection to the customer based on the information sent.
Using System;
Using System.Collections.Gen
Grasp the Stream in VB. NET (2)
Flexible and diverse
IO
OperationSometimes conversion between data and byte arrays is cumbersome. To avoid these boring conversions and simplified code, it is wise to use streamreader/streamwrite and binaryreader/binarywriter. Streamreader and streamwrite are derived from the textreader and textwriter classes respectively, and are automatically converted to Byte encoding. Binaryrea
BMP file in the format of {image BMP = (Bitmap) image. fromfile ("BMP testimg.bmp"); memorystream bmp data = new memorystream (); BMP. save (BMP data, imageformat. BMP); binaryreader BR = new binaryreader (BMP data ); // Why do we need to offset 18 bytes because the BMP format "" starts to store the image width and height BMP data with a 32-bit integer at the location of 18 bytes. seek (18, seekorigin. beg
() {// save the file to the root directory App_Data + get the file name and format var filePath = Server. MapPath ("~ /App_Data/") + Request. form ["fileName"]; // create an append (FileMode. append) mode file stream using (FileStream fs = new FileStream (filePath, FileMode. append, FileAccess. write) {using (BinaryWriter bw = new BinaryWriter (fs) {// read the file stream BinaryReader br = new BinaryReader
1. First step using OpenSSL to convert Pem key to der key//e:\01doc\bin>openssl.exe rsa-in rsakeydec.pem-outform der-out pri.der2, call the following program directly read der converted to C # required XML key, and then ciphertext decryption3. OpenSSLhttp://download.csdn.net/download/jiayanhui2877/4089521usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.IO;usingSystem.Security.Cryptography;usingSystem.ComponentModel;usingSystem.Runtime.InteropServices;/*re
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.