comparison base/src/java/io/BufferedInputStream.d @ 112:9f4c18c268b2

Update to compile and execute with dmd 2.052.
author kntroh
date Wed, 16 Mar 2011 21:53:53 +0900
parents 1bf55a6eb092
children
comparison
equal deleted inserted replaced
111:b6e9904989ed 112:9f4c18c268b2
52 if( count < 0 ){ 52 if( count < 0 ){
53 count = 0; 53 count = 0;
54 istr = null; 54 istr = null;
55 } 55 }
56 } 56 }
57 public synchronized int read(){ 57 public int read(){
58 if( pos >= count ){ 58 synchronized {
59 fill();
60 if( pos >= count ){ 59 if( pos >= count ){
61 return -1; 60 fill();
61 if( pos >= count ){
62 return -1;
63 }
62 } 64 }
65 return getAndCheckBuf()[pos++] & 0xFF;
63 } 66 }
64 return getAndCheckBuf()[pos++] & 0xFF;
65 } 67 }
66 68
67 public synchronized int read( byte[] b, int off, int len ){ 69 public int read( byte[] b, int off, int len ){
68 return super.read( b, off, len ); 70 synchronized return super.read( b, off, len );
69 } 71 }
70 72
71 public synchronized long skip( long n ){ 73 public long skip( long n ){
72 return this.istr.skip(n); 74 synchronized return this.istr.skip(n);
73 } 75 }
74 76
75 public synchronized int available(){ 77 public int available(){
76 int istr_avail = 0; 78 synchronized {
77 if( istr !is null ){ 79 int istr_avail = 0;
78 istr_avail = istr.available(); 80 if( istr !is null ){
81 istr_avail = istr.available();
82 }
83 return istr_avail + (count - pos);
79 } 84 }
80 return istr_avail + (count - pos);
81 } 85 }
82 86
83 public synchronized void mark( int readlimit ){ 87 public synchronized void mark( int readlimit ){
84 implMissing( __FILE__, __LINE__ ); 88 implMissing( __FILE__, __LINE__ );
85 this.istr.mark( readlimit ); 89 this.istr.mark( readlimit );