Moved bit input and output streams into Svjatoslav Commons library.
[imagesqueeze.git] / src / main / java / eu / svjatoslav / imagesqueeze / codec / ImageMetaData.java
1 /*
2  * Imagesqueeze - Image codec optimized for photos.
3  * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of version 2 of the GNU General Public License
7  * as published by the Free Software Foundation.
8  */
9
10 package eu.svjatoslav.imagesqueeze.codec;
11
12 /**
13  * Class to hold image metadata.
14  * Like image dimensions, header version, compression quality, etc.. 
15  */
16
17 import java.io.IOException;
18
19 import eu.svjatoslav.commons.data.BitInputStream;
20 import eu.svjatoslav.commons.data.BitOutputStream;
21
22 public class ImageMetaData {
23
24         int version;
25         int width;
26         int height;
27
28         public void load(final BitInputStream inputStream) throws IOException {
29
30                 version = inputStream.readBits(16);
31                 width = inputStream.readIntegerCompressed8();
32                 height = inputStream.readIntegerCompressed8();
33
34         }
35
36         public void save(final BitOutputStream outputStream) throws IOException {
37
38                 outputStream.storeBits(version, 16);
39                 outputStream.storeIntegerCompressed8(width);
40                 outputStream.storeIntegerCompressed8(height);
41
42         }
43
44 }