Mercurial > projects > dwt-mac
comparison dwt/internal/image/PngInputStream.d @ 6:b903c16b6f48
Removed throws decls
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 14:10:03 +0200 |
parents | 1a8b3cb347e0 |
children | 5123b17c98ef |
comparison
equal
deleted
inserted
replaced
5:1a8b3cb347e0 | 6:b903c16b6f48 |
---|---|
25 this.reader = reader; | 25 this.reader = reader; |
26 length = chunk.getLength(); | 26 length = chunk.getLength(); |
27 offset = 0; | 27 offset = 0; |
28 } | 28 } |
29 | 29 |
30 private bool checkChunk() throws IOException { | 30 private bool checkChunk() { |
31 while (offset is length) { | 31 while (offset is length) { |
32 chunk = reader.readNextChunk(); | 32 chunk = reader.readNextChunk(); |
33 if (chunk is null) throw new IOException(); | 33 if (chunk is null) throw new IOException(); |
34 if (chunk.getChunkType() is PngChunk.CHUNK_IEND) return false; | 34 if (chunk.getChunkType() is PngChunk.CHUNK_IEND) return false; |
35 if (chunk.getChunkType() !is PngChunk.CHUNK_IDAT) throw new IOException(); | 35 if (chunk.getChunkType() !is PngChunk.CHUNK_IDAT) throw new IOException(); |
37 offset = 0; | 37 offset = 0; |
38 } | 38 } |
39 return true; | 39 return true; |
40 } | 40 } |
41 | 41 |
42 public void close() throws IOException { | 42 public void close() { |
43 chunk = null; | 43 chunk = null; |
44 } | 44 } |
45 | 45 |
46 public int read() throws IOException { | 46 public int read() { |
47 if (chunk is null) throw new IOException(); | 47 if (chunk is null) throw new IOException(); |
48 if (offset is length && !checkChunk()) return -1; | 48 if (offset is length && !checkChunk()) return -1; |
49 int b = chunk.reference[DATA_OFFSET + offset] & 0xFF; | 49 int b = chunk.reference[DATA_OFFSET + offset] & 0xFF; |
50 offset++; | 50 offset++; |
51 return b; | 51 return b; |
52 } | 52 } |
53 | 53 |
54 public int read(byte[] b, int off, int len) throws IOException { | 54 public int read(byte[] b, int off, int len) { |
55 if (chunk is null) throw new IOException(); | 55 if (chunk is null) throw new IOException(); |
56 if (offset is length && !checkChunk()) return -1; | 56 if (offset is length && !checkChunk()) return -1; |
57 len = Math.min(len, length - offset); | 57 len = Math.min(len, length - offset); |
58 System.arraycopy(chunk.reference, DATA_OFFSET + offset, b, off, len); | 58 System.arraycopy(chunk.reference, DATA_OFFSET + offset, b, off, len); |
59 offset += len; | 59 offset += len; |