X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=imagesqueeze.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fimagesqueeze%2Fcodec%2FImageMetaData.java;h=1c0fc7b672129e2ba49148192c5274e5e3bb6b79;hp=68b3bea33b449d541af183236e7b618ebebc851d;hb=HEAD;hpb=c7d0b8e1723045c0df086d9214a35f54db47684c diff --git a/src/main/java/eu/svjatoslav/imagesqueeze/codec/ImageMetaData.java b/src/main/java/eu/svjatoslav/imagesqueeze/codec/ImageMetaData.java index 68b3bea..1c0fc7b 100755 --- a/src/main/java/eu/svjatoslav/imagesqueeze/codec/ImageMetaData.java +++ b/src/main/java/eu/svjatoslav/imagesqueeze/codec/ImageMetaData.java @@ -1,34 +1,35 @@ +/* + * Image codec. Author: Svjatoslav Agejenko, svjatoslav@svjatoslav.eu + * This project is released under Creative Commons Zero (CC0) license. + */ package eu.svjatoslav.imagesqueeze.codec; /** * Class to hold image metadata. - * Like image dimensions, header version, compression quality, etc.. + * Like image dimensions, header version, compression quality, etc.. */ -import java.io.IOException; +import eu.svjatoslav.commons.data.BitInputStream; +import eu.svjatoslav.commons.data.BitOutputStream; +import java.io.IOException; public class ImageMetaData { - int version; - int width; - int height; - - - public void load(BitInputStream inputStream) throws IOException{ - - version = inputStream.readBits(16); - width = inputStream.readIntegerCompressed8(); - height = inputStream.readIntegerCompressed8(); - - } - - public void save(BitOutputStream outputStream) throws IOException{ - - outputStream.storeBits(version, 16); - outputStream.storeIntegerCompressed8(width); - outputStream.storeIntegerCompressed8(height); - - } + int version; + int width; + int height; + + public void load(final BitInputStream inputStream) throws IOException { + version = inputStream.readBits(16); + width = ImageDecoder.readIntegerCompressed8(inputStream); + height = ImageDecoder.readIntegerCompressed8(inputStream); + } + + public void save(final BitOutputStream outputStream) throws IOException { + outputStream.storeBits(version, 16); + ImageEncoder.storeIntegerCompressed8(outputStream, width); + ImageEncoder.storeIntegerCompressed8(outputStream, height); + } }