Click here to Skip to main content
11,642,855 members (79,452 online)
Click here to Skip to main content
Articles » Languages » C# » General » Downloads
Add your own
alternative version

Accessing alternative data-streams of files on an NTFS volume

, 28 Jul 2010 CPOL 241.4K 3.9K 109
A pair of classes to encapsulate access to NTFS alternative data streams.
Compatibility wrapper
Unblock Files
using System;
using System.IO;
using Trinet.Core.IO.Ntfs;

namespace NTFS
	public sealed class StreamInfo
		private readonly AlternateDataStreamInfo _stream;
		internal StreamInfo(AlternateDataStreamInfo stream)
			_stream = stream;
		public string Name
			get { return _stream.Name; }
		public long Size
			get { return _stream.Size; }
		public override int GetHashCode()
			return _stream.GetHashCode();
		public override string ToString()
			return _stream.ToString();
		public override bool Equals(object obj)
			if (object.ReferenceEquals(null, obj)) return false;
			if (object.ReferenceEquals(this, obj)) return true;
			StreamInfo info = obj as StreamInfo;
			if (null != info) return _stream.Equals(info._stream);
			AlternateDataStreamInfo other = obj as AlternateDataStreamInfo;
			if (null != other) return _stream.Equals(other);
			string path = obj as string;
			if (null != path) return string.Equals(path, _stream.FullPath, StringComparison.OrdinalIgnoreCase);
			return false;
		public FileStream Open(FileMode mode, FileAccess access, FileShare share)
			return _stream.Open(mode, access, share);
		public FileStream Open(FileMode mode, FileAccess access)
			return this.Open(mode, access, FileShare.None);
		public FileStream Open(FileMode mode)
			return this.Open(mode, FileAccess.ReadWrite, FileShare.None);
		public FileStream Open()
			return this.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
		public bool Delete()
			return _stream.Delete();

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Richard Deeming
Software Developer Nevalee Business Solutions
United Kingdom United Kingdom
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150731.1 | Last Updated 28 Jul 2010
Article Copyright 2002 by Richard Deeming
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid