All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xxdb.io.BigEndianDataInputStream Maven / Gradle / Ivy

There is a newer version: 3.00.2.2
Show newest version
package com.xxdb.io;

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

public class BigEndianDataInputStream extends AbstractExtendedDataInputStream{

	public BigEndianDataInputStream(InputStream in) {
		super(in);
	}

	@Override
	public int readInt() throws IOException {
		byte b1 = readAndCheckByte();
		byte b2 = readAndCheckByte();
		byte b3 = readAndCheckByte();
		byte b4 = readAndCheckByte();
		return fromBytes(b1, b2, b3, b4);
	}

	@Override
	public long readLong() throws IOException {
		byte b1 = readAndCheckByte();
		byte b2 = readAndCheckByte();
		byte b3 = readAndCheckByte();
		byte b4 = readAndCheckByte();
		byte b5 = readAndCheckByte();
		byte b6 = readAndCheckByte();
		byte b7 = readAndCheckByte();
		byte b8 = readAndCheckByte();
		return fromBytes(b1, b2, b3, b4, b5, b6, b7, b8);
	}
	
	
	public Long2 readLong2() throws IOException {
		long high = readLong();
		long low = readLong();
		return new Long2(high, low);
	}
	
	public Double2 readDouble2() throws IOException {
		double x = readDouble();
		double y = readDouble();
		return new Double2(x, y);
	}

	@Override
	public int readUnsignedShort() throws IOException {
		byte b1 = readAndCheckByte();
		byte b2 = readAndCheckByte();
		return fromBytes(b1, b2, (byte)0, (byte)0);
	}

	@Override
	public boolean isLittleEndian() {
		return false;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy