~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric

« back to all changes in this revision

Viewing changes to contrib/Sharpen/Sharpen/FileInputStream.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-06-27 17:03:13 UTC
  • mto: (1.8.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 54.
  • Revision ID: james.westby@ubuntu.com-20110627170313-6cvz3s19x6e9hqe9
ImportĀ upstreamĀ versionĀ 2.5.92+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
namespace Sharpen
 
2
{
 
3
        using System;
 
4
        using System.IO;
 
5
 
 
6
        internal class FileInputStream : InputStream
 
7
        {
 
8
                public FileInputStream (FilePath file) : this(file.GetPath ())
 
9
                {
 
10
                }
 
11
 
 
12
                public FileInputStream (string file)
 
13
                {
 
14
                        if (!File.Exists (file)) {
 
15
                                throw new FileNotFoundException ("File not found", file);
 
16
                        }
 
17
                        base.Wrapped = new FileStream (file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
 
18
                }
 
19
 
 
20
                public FileChannel GetChannel ()
 
21
                {
 
22
                        return new FileChannel ((FileStream)base.Wrapped);
 
23
                }
 
24
        }
 
25
}