本文整理汇总了Java中com.google.common.io.LittleEndianDataInputStream.readInt方法的典型用法代码示例。如果您正苦于以下问题:Java LittleEndianDataInputStream.readInt方法的具体用法?Java LittleEndianDataInputStream.readInt怎么用?Java LittleEndianDataInputStream.readInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.io.LittleEndianDataInputStream
的用法示例。
在下文中一共展示了LittleEndianDataInputStream.readInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: IfcGeomServerClient
import com.google.common.io.LittleEndianDataInputStream; //导入方法依赖的package包/类
public IfcGeomServerClient(String executableFilename) throws RenderEngineException {
try {
process = Runtime.getRuntime().exec(executableFilename);
dos = new LittleEndianDataOutputStream(process.getOutputStream());
dis = new LittleEndianDataInputStream(process.getInputStream());
if (dis.readInt() != HELLO) {
terminate();
LOGGER.error("Invalid welcome message received");
return;
}
Hello h = new Hello(); h.read(dis);
String reportedVersion = h.getString();
if (!VERSION.equals(reportedVersion)) {
terminate();
LOGGER.error(String.format("Version mismatch: Plugin version %s does not match IfcOpenShell version %s", VERSION, reportedVersion));
return;
}
} catch (IOException e) {
throw new RenderEngineException(e);
}
}
示例2: read_contents
import com.google.common.io.LittleEndianDataInputStream; //导入方法依赖的package包/类
@Override
void read_contents(LittleEndianDataInputStream s) throws IOException {
entity = new IfcGeomServerClientEntity(
s.readInt(),
readString(s),
readString(s),
readString(s),
s.readInt(),
readDoubleWhichShouldBeFloatArray(s),
s.readInt(),
readFloatArray(s),
readFloatArray(s),
readIntArray(s),
readFloatArray(s),
readIntArray(s)
);
}
示例3: readTile
import com.google.common.io.LittleEndianDataInputStream; //导入方法依赖的package包/类
private Tile readTile(LittleEndianDataInputStream stream, int x, int y) throws IOException {
Tile tile = new Tile(tiles[x][y]);
int attributes = stream.read();
if (attributes==1 || attributes==3) {
int length = stream.read();
byte[] textBytes = new byte[length];
stream.read(textBytes);
String text = new String(textBytes, "US-ASCII");
tile.setLabel(new Label(Font.decode("Arial-18"), text, new Color(0, 0, 0)), false);
stream.skipBytes(3);
}
if (attributes==2 || attributes==3) {
stream.skipBytes(4);
}
int terrain = stream.read();
GroundData ground = WAKData.grounds.get(terrain);
tile.setGround(ground, RoadDirection.CENTER, false);
int itemsNumber = stream.readInt();
for (int i=0; i<itemsNumber; i++) {
readObject(stream, tile);
}
return tile;
}
示例4: readData
import com.google.common.io.LittleEndianDataInputStream; //导入方法依赖的package包/类
public static ComponentData readData(
LittleEndianDataInputStream dataStream, short fileversion)
throws IOException {
ComponentData data = new ComponentData();
data.lengthOfComponentName = dataStream.readInt();
data.totalNumberOfComponents = dataStream.readInt();
data.numberOfOilComponents = dataStream.readInt();
data.numberOfChemComponents = dataStream.readInt();
data.numberOfParticleMaterialComponents = dataStream.readInt();
// gas particles from version 23
if (fileversion >= GRF.GRFFILEGASVERSION) {
data.numberOfGasComponents = dataStream.readInt(); // number gas
// components
}
byte[] componentName = new byte[data.lengthOfComponentName];
for (int i = 0; i < data.totalNumberOfComponents; i++) {
dataStream.read(componentName);
data.components.add(new Component(new String(componentName),
dataStream.readFloat() /* density */, dataStream
.readFloat() /* background concentration */,
dataStream.readShort() /* is degradable */
));
}
return data;
}
示例5: readData
import com.google.common.io.LittleEndianDataInputStream; //导入方法依赖的package包/类
/**
*
* @param dataStream
* @throws IOException
*/
public static ResponseData readData(
LittleEndianDataInputStream dataStream) throws IOException {
ResponseData data = new ResponseData();
int lengthOfResponseVesselName = dataStream.readInt();
int numberResponseVessels = dataStream.readInt();
if (numberResponseVessels > 0) {
Vector<String> units = new Vector<String>();
for (int i = 0; i < numberResponseVessels; i++) {
units.add(getString(dataStream, lengthOfResponseVesselName));
}
data.units = units;
}
return data;
}
示例6: readString
import com.google.common.io.LittleEndianDataInputStream; //导入方法依赖的package包/类
protected String readString(LittleEndianDataInputStream s) throws IOException {
int len = s.readInt();
byte[] b = new byte[len];
s.readFully(b);
String str = new String(b);
while (len++ % 4 != 0) s.read();
return str;
}
示例7: readFloatArray
import com.google.common.io.LittleEndianDataInputStream; //导入方法依赖的package包/类
protected float[] readFloatArray(LittleEndianDataInputStream s) throws IOException {
int len = s.readInt() / 4;
float[] fs = new float[len];
for (int i = 0; i < len; ++i) {
fs[i] = s.readFloat();
}
return fs;
}
示例8: readDoubleArray
import com.google.common.io.LittleEndianDataInputStream; //导入方法依赖的package包/类
protected double[] readDoubleArray(LittleEndianDataInputStream s) throws IOException {
int len = s.readInt() / 4;
double[] fs = new double[len];
for (int i = 0; i < len; ++i) {
fs[i] = s.readDouble();
}
return fs;
}
示例9: readDoubleWhichShouldBeFloatArray
import com.google.common.io.LittleEndianDataInputStream; //导入方法依赖的package包/类
protected double[] readDoubleWhichShouldBeFloatArray(LittleEndianDataInputStream s) throws IOException {
int len = s.readInt() / 4;
double[] fs = new double[len];
for (int i = 0; i < len; ++i) {
// TODO ask IOS to return doubles
fs[i] = s.readFloat();
}
return fs;
}
示例10: readIntArray
import com.google.common.io.LittleEndianDataInputStream; //导入方法依赖的package包/类
protected int[] readIntArray(LittleEndianDataInputStream s) throws IOException {
int len = s.readInt() / 4;
int[] is = new int[len];
for (int i = 0; i < len; ++i) {
is[i] = s.readInt();
}
return is;
}
示例11: getInt
import com.google.common.io.LittleEndianDataInputStream; //导入方法依赖的package包/类
private static int getInt(LittleEndianDataInputStream ledis) throws IOException {
short fieldLength = ledis.readShort();
if (fieldLength != 4) {
throw new IllegalStateException("Int required but length was " + fieldLength);
}
return ledis.readInt();
}
示例12: whenWriteReadLittleEndian_thenCorrect
import com.google.common.io.LittleEndianDataInputStream; //导入方法依赖的package包/类
@Test
public void whenWriteReadLittleEndian_thenCorrect() throws IOException {
final int value = 100;
final LittleEndianDataOutputStream writer = new LittleEndianDataOutputStream(new FileOutputStream("src/test/resources/test_le.txt"));
writer.writeInt(value);
writer.close();
final LittleEndianDataInputStream reader = new LittleEndianDataInputStream(new DataInputStream(new FileInputStream("src/test/resources/test_le.txt")));
final int result = reader.readInt();
reader.close();
assertEquals(value, result);
}
示例13: Map
import com.google.common.io.LittleEndianDataInputStream; //导入方法依赖的package包/类
private Map(LittleEndianDataInputStream stream) throws DeedPlannerException, IOException {
byte[] wakWordBytes = new byte[3];
stream.read(wakWordBytes);
String wakWordString = new String(wakWordBytes, "US-ASCII");
if (!"WMP".equals(wakWordString)) {
throw new DeedPlannerException("Not a WAK map");
}
stream.skipBytes(20);
width = Math.max(stream.readInt(), 50);
height = Math.max(stream.readInt(), 50);
tiles = new Tile[width+1][height+1];
for (int i=0; i<=width; i++) {
for (int i2=0; i2<=height; i2++) {
tiles[i][i2] = new Tile(this, i, i2);
}
}
boolean bigMap = width > 255 || height> 255;
stream.skipBytes(34);
int tileCount = stream.readInt();
for (int i=0; i<tileCount; i++) {
final int x = readCoordinate(stream, bigMap);
final int y = height - readCoordinate(stream, bigMap) - 1;
final int layers = stream.read();
if (layers==1 || layers==3) {
tiles[x][y] = readTile(stream, x, y);
}
if (layers==2 || layers==3) {
readTile(stream, x, y);
}
}
createHeightData();
}
示例14: readCoordinate
import com.google.common.io.LittleEndianDataInputStream; //导入方法依赖的package包/类
private int readCoordinate(LittleEndianDataInputStream stream, boolean bigMap) throws IOException {
if (bigMap) {
return stream.readInt();
}
else {
return stream.read();
}
}
示例15: readData
import com.google.common.io.LittleEndianDataInputStream; //导入方法依赖的package包/类
/**
*
* @param datastream
* @return
* @throws IOException
*/
public static SurfaceCellOil readData(LittleEndianDataInputStream datastream) throws IOException {
SurfaceCellOil data = new SurfaceCellOil();
data.cellIndex = datastream.readInt();
data.thickness = datastream.readFloat();
data.emulsionWaterContent = datastream.readFloat();
data.emulsionViscosity = datastream.readFloat();
data.coverage = datastream.readFloat();
return data;
}