Mercurial > hg > digilib-old
comparison servlet/src/digilib/io/ImageFile.java @ 590:69bc69381ac4 stream
more work on stream input and more cleanup
author | robcast |
---|---|
date | Thu, 06 Jan 2011 20:42:29 +0100 |
parents | aee436f0549d |
children | 2b58d2783ef0 |
comparison
equal
deleted
inserted
replaced
589:73e041c710d3 | 590:69bc69381ac4 |
---|---|
20 */ | 20 */ |
21 | 21 |
22 package digilib.io; | 22 package digilib.io; |
23 | 23 |
24 import java.io.File; | 24 import java.io.File; |
25 import java.io.FileNotFoundException; | |
25 import java.io.IOException; | 26 import java.io.IOException; |
27 import java.io.RandomAccessFile; | |
28 | |
29 import javax.imageio.stream.FileImageInputStream; | |
30 import javax.imageio.stream.ImageInputStream; | |
26 | 31 |
27 import digilib.image.ImageSize; | 32 import digilib.image.ImageSize; |
28 import digilib.servlet.DigilibConfiguration; | 33 import digilib.servlet.DigilibConfiguration; |
29 | 34 |
30 /** | 35 /** |
112 */ | 117 */ |
113 public String getName() { | 118 public String getName() { |
114 return name; | 119 return name; |
115 } | 120 } |
116 | 121 |
117 /** | 122 |
118 * @return File | 123 /* (non-Javadoc) |
124 * @see digilib.io.ImageInput#hasImageInputStream() | |
125 */ | |
126 @Override | |
127 public boolean hasImageInputStream() { | |
128 return true; | |
129 } | |
130 | |
131 /* (non-Javadoc) | |
132 * @see digilib.io.ImageInput#getImageInputStream() | |
133 */ | |
134 @Override | |
135 public ImageInputStream getImageInputStream() { | |
136 try { | |
137 RandomAccessFile rf = new RandomAccessFile(file, "r"); | |
138 return new FileImageInputStream(rf); | |
139 } catch (IOException e) { | |
140 // what now? | |
141 } | |
142 return null; | |
143 } | |
144 | |
145 /* (non-Javadoc) | |
146 * @see digilib.io.ImageInput#hasFile() | |
147 */ | |
148 @Override | |
149 public boolean hasFile() { | |
150 return true; | |
151 } | |
152 | |
153 /* (non-Javadoc) | |
154 * @see digilib.io.ImageInput#getFile() | |
119 */ | 155 */ |
120 public File getFile() { | 156 public File getFile() { |
121 return file; | 157 return file; |
122 } | 158 } |
123 | 159 |