package com.jscape.inet.ssh.protocol.v2.marshaling.primitive;

import com.jscape.util.io.primitive.IntCodec;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * @author Alex Usun
 */
public class Uint32Codec {

    public static int readValue(InputStream in)
            throws IOException {
        return IntCodec.readBigEndianValue(in);
    }

    public static long readLongValue(InputStream in)
            throws IOException {
        return readValue(in) & 0xFFFFFFFFL;
    }

    public static void writeValue(int value, OutputStream out)
            throws IOException {
        IntCodec.writeBigEndianValue(value, out);
    }

    public static void writeValue(long value, OutputStream out)
            throws IOException {
        writeValue((int) value, out);
    }

    private Uint32Codec() {
    }
}
