![]() ![]() New FileInputStream(new File(imageEntry.getFileName())) Private static final Log logger = LogFactory.getLog(ImageServiceImpl.class) īyteArrayOutputStream outStream = new ByteArrayOutputStream() Public class ImageServiceImpl implements ImageService It could also be done by returning an InputStream instead of the byte array. Retrieving an image or its thumbnail is done by looking up the record in the database via its unique ID, retrieving the full path to the file system file, reading data from the file, and returning the data as a byte array. This file name along with other information, such as the file name on the client's computer and the content type is saved into a database record. The name of the files are generated via random UUIDs. This implementation stores the image and a scaled thumbnail as files on the file system in a special folder. We have a special implementation of the ImageService interface called ImageServiceImpl. Throws void save(ImageEntry imageEntry, InputStream imageStream) Public byte getThumbnail(ImageEntry imageEntry) Public Date getLastModifyTime(ImageEntry imageEntry) Public boolean isImageAvailable(ImageEntry imageEntry) ![]() Public byte getImage(ImageEntry imageEntry) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |