Mercurial > projects > dwt-mac
comparison dwt/dwthelper/FileInputStream.d @ 134:623ff6db5f1d
Updated to Tango 0.99.8
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 24 May 2009 22:21:00 +0200 |
parents | c74ba20de292 |
children |
comparison
equal
deleted
inserted
replaced
133:6541b60caf79 | 134:623ff6db5f1d |
---|---|
4 module dwt.dwthelper.FileInputStream; | 4 module dwt.dwthelper.FileInputStream; |
5 | 5 |
6 import dwt.dwthelper.utils; | 6 import dwt.dwthelper.utils; |
7 import dwt.dwthelper.File; | 7 import dwt.dwthelper.File; |
8 import dwt.dwthelper.InputStream; | 8 import dwt.dwthelper.InputStream; |
9 | 9 import TangoFile = tango.io.device.File; |
10 version (LDC) | |
11 { | |
12 import Tango = tango.io.device.File; | |
13 alias Tango.File FileConduit; | |
14 } | |
15 | |
16 else | |
17 import tango.io.device.FileConduit; | |
18 | |
19 | |
20 import tango.io.protocol.Reader; | 10 import tango.io.protocol.Reader; |
21 import tango.core.Exception; | 11 import tango.core.Exception; |
22 import tango.text.convert.Format; | 12 import tango.text.convert.Format; |
23 | 13 |
24 public class FileInputStream : dwt.dwthelper.InputStream.InputStream { | 14 public class FileInputStream : dwt.dwthelper.InputStream.InputStream { |
25 | 15 |
26 alias dwt.dwthelper.InputStream.InputStream.read read; | 16 alias dwt.dwthelper.InputStream.InputStream.read read; |
27 | 17 |
28 private FileConduit conduit; | 18 private TangoFile.File conduit; |
29 private ubyte[] buffer; | 19 private ubyte[] buffer; |
30 private int buf_pos; | 20 private int buf_pos; |
31 private int buf_size; | 21 private int buf_size; |
32 private const int BUFFER_SIZE = 0x10000; | 22 private const int BUFFER_SIZE = 0x10000; |
33 private bool eof; | 23 private bool eof; |
34 | 24 |
35 public this ( char[] name ){ | 25 public this ( char[] name ){ |
36 conduit = new FileConduit( name ); | 26 conduit = new TangoFile.File( name ); |
37 buffer = new ubyte[]( BUFFER_SIZE ); | 27 buffer = new ubyte[]( BUFFER_SIZE ); |
38 } | 28 } |
39 | 29 |
40 public this ( dwt.dwthelper.File.File file ){ | 30 public this ( dwt.dwthelper.File.File file ){ |
41 implMissing( __FILE__, __LINE__ ); | 31 implMissing( __FILE__, __LINE__ ); |
42 conduit = new FileConduit( file.getAbsolutePath(), FileConduit.ReadExisting ); | 32 conduit = new TangoFile.File( file.getAbsolutePath(), TangoFile.File.ReadExisting); |
43 buffer = new ubyte[]( BUFFER_SIZE ); | 33 buffer = new ubyte[]( BUFFER_SIZE ); |
44 } | 34 } |
45 | 35 |
46 public override int read(){ | 36 public override int read(){ |
47 if( eof ){ | 37 if( eof ){ |