comparison java/src/java/io/ByteArrayInputStream.d @ 0:6dd524f61e62

add dwt win and basic java stuff
author Frank Benoit <benoit@tionex.de>
date Mon, 02 Mar 2009 14:44:16 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:6dd524f61e62
1 /* language convertion www.dsource.org/project/tioport */
2 module java.io.ByteArrayInputStream;
3
4 import java.io.InputStream;
5
6 public class ByteArrayInputStream : java.io.InputStream.InputStream {
7
8 alias java.io.InputStream.InputStream.read read;
9 alias java.io.InputStream.InputStream.skip skip;
10 alias java.io.InputStream.InputStream.available available;
11 alias java.io.InputStream.InputStream.close close;
12 alias java.io.InputStream.InputStream.mark mark;
13 alias java.io.InputStream.InputStream.reset reset;
14 alias java.io.InputStream.InputStream.markSupported markSupported;
15
16 protected byte[] buf;
17 protected int pos;
18 protected int fld_mark = 0;
19 //protected int count;
20 public this ( byte[] aBuf ){
21 this.buf = aBuf;
22 }
23
24 public this ( byte[] aBuf, int offset, int length_ESCAPE ){
25 this.buf = aBuf[ offset .. offset+length_ESCAPE ];
26 }
27
28 public synchronized int read(){
29 if( pos >= this.buf.length ){
30 return -1;
31 }
32 int result = this.buf[pos];
33 pos++;
34 return result & 0xFF;
35 }
36
37 public synchronized int read( byte[] b, int off, int len ){
38 return super.read( b, off, len );
39 }
40
41 public synchronized long skip( long n ){
42 pos += n;
43 return 0L;
44 }
45
46 public synchronized int available(){
47 if( pos >= this.buf.length ){
48 return 0;
49 }
50 return this.buf.length - pos;
51 }
52
53 public bool markSupported(){
54 return false;
55 }
56
57 public void mark( int readAheadLimit ){
58 }
59
60 public synchronized void reset(){
61 pos = 0;
62 }
63
64 public void close(){
65 }
66
67
68 }
69
70