- In .NET 2.0, there are new types of applications that are meant to be deployed and installed from Web pages called “Click-Once applications” or, sometimes, “Smart-client applications.” These new types of applications are meant to solve deployment of applications across a company or enterprise.
- Isolated Storage means the application will be able to hold data temoporarily in a system provided secure area.
- We may create both Application-level data store and User-level data store.
- IsolatedStorageFile class (and its static methods) is used for this purpose.
- IsolatedStorageFileStream is derived from FileStream class.
- Get the appropriate data store for Application/User. Create an IsolatedStorageFileStream object specifying the usual filename, FileMode and the store in which to create the file. Once this is done, its all the same as using a FileStream with StreamReader/StreamWriter.
Showing posts with label Streams. Show all posts
Showing posts with label Streams. Show all posts
Thursday, June 11, 2009
Chapter 2-Lesson 4
Chapter 3-Lesson 3
- Both GZip and DEFLATE compression systems allow compression for a maximum of 4GB data.
- GZipStream is useful for wider distribution scenario while DeflateStream is useful for relatively smaller size (because it does not include header information)
- Compression Streams would always wrap the FileStream with compressed data, whether during Compression or Decompression.
Sunday, June 7, 2009
Chapter 2-Lesson 2
- Most operations with Streams involve the File class
- StreamReader and StreamWriter classes allow for sequential reading and writing of data.
- Static methods in the File class are almost identical to the FileInfo class.
- Simple Create( ) method (or Open, etc) would return a FileStream object where as CreateText( ) method (or OpenText, etc) would return a StreamReader/StreamWriter object.
- The Directory class provides static methods for routine directory operations.
- The FileAccess enum provides the possible rights assigned when accessing a file.
- Using FileAccess.Read would allow read-only access, whereas FileAccess.Write would allow append-only access.
- The FileMode enum determines whether file would be created or opened or deleted, etc.
- FileMode.Append can only be used with FileAccess.Write
- FileMode.Create overwrites any existing file while FileMode.CreateNew throws an exception if file exists.
- Similarly FileMode.Open would throw an exception if file does not exist but FileMode.OpenOrCreate wont.
- The Length property of the Stream class returns length of a stream in bytes.
- The SetLength property will Truncate (shrink) the contents of the stream if new length is lesser than the old one and vice versa.
- The StreamReader is intended to read the Stream as a string rather than as bytes.
- The StreamReader class is derived from the abstract TextReader class. StreamWriter derives from TextWriter abstract class.
- Similarly StringReader/StringWriter inherit from TextReader/TextWriter class. StringWriter uses a StringBuilder.
- For non-textual data there are BinaryReader/BinaryWriter classes.
- One use of MemoryStream is like we use datasets for database operations. You may continue to write on a MemoryStream and when you decide to make chages permanent you wirte a MemoryStream to a FileStream. This would lock the actual file for a short period of time reducing accessibility downtime.
Subscribe to:
Posts (Atom)