DelphiBasics
  Home  |  Delphi .net Home  |  System.IO NameSpace
 .NET Framework
 Namespace References

 System
 System.Collections
 System.Globalization
 System.IO
 
  BinaryReader  Class 
  BinaryWriter  Class 
  BufferedStream  Class 
  Directory  Class 
  DirectoryInfo  Class 
  File  Class 
  FileAccess  Enumeration 
  FileAttributes  Enumeration 
  FileInfo  Class 
  FileMode  Enumeration 
  FileShare  Enumeration 
  FileStream  Class 
  FileSystemWatcher  Class 
  MemoryStream  Class 
  Path  Class 
  SeekOrigin  Enumeration 
  StreamReader  Class 
  StreamWriter  Class 
  StringReader  Class 
  StringWriter  Class 

 Articles and Tutorials

 Overview of .NET
 Delphi and .NET
 Winform Applications
 ASP .Net Applications
 php Web Services
 Framework Collections
 Framework String Handling
 Framework Files and Folders


 
 
  System.IO.BinaryWriter Class
 
 Description
This class is used to write primitive data in binary (rather than character) format to a stream. This stream is often targetted at a file, as in the examples.
 
The Write method provides good flexibility, allowing a range of primitive types, including strings to be written to the stream, with conversion to byte format where appropriate. For example, a Boolean true value gets stored in a whole byte with value of 1.
 
When reading from a Binary file, it is crucial that the formatting of data used by BinaryWriter be accurately recognised. Being 1 byte out of sequence can completely destroy the sequencing of the remaining file contents.
 Syntax
Constructor Create ( );
Constructor Create ( DataStream : Stream ; );
Constructor Create ( DataStream : Stream; TextEncoding : System.Text.Encoding );
 Methods
Close  Closes the BinaryWriter
Seek  Seek to a specified offset from the start, current, or end stream position
Write  Write a primitive data element to the stream

 Fields
Null  BinaryWriter  Specifies a BinaryWriter with no backing store.
 Properties
BaseStream  BinaryWriter  Gets the underlying stream of the BinaryWriter.

 Microsoft MSDN links
 
System.IO
System.IO.binarywriter
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page