/* * Copyright (C) 2015 RankSys http://ranksys.org * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.ranksys.compression.codecs.dsi; import it.unimi.dsi.io.InputBitStream; import it.unimi.dsi.io.OutputBitStream; import java.io.IOException; /** * Gamma coding. * * @author Saúl Vargas (Saul.Vargas@glasgow.ac.uk) */ public class GammaBitStreamCODEC extends BitStreamCODEC { @Override protected void write(OutputBitStream obs, int[] in, int offset, int len) throws IOException { for (int i = offset; i < offset + len; i++) { obs.writeGamma(in[i]); } } @Override protected void read(InputBitStream ibs, int[] out, int offset, int len) throws IOException { ibs.readGammas(out, len); } }