本文整理汇总了Java中com.google.common.io.LittleEndianDataInputStream类的典型用法代码示例。如果您正苦于以下问题:Java LittleEndianDataInputStream类的具体用法?Java LittleEndianDataInputStream怎么用?Java LittleEndianDataInputStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LittleEndianDataInputStream类属于com.google.common.io包,在下文中一共展示了LittleEndianDataInputStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: doStart
import com.google.common.io.LittleEndianDataInputStream; //导入依赖的package包/类
private final void doStart() throws IOException {
ReadUtil.readCheckType(m_stream, AXML_CHUNK_TYPE);
/*chunk size*/
ReadUtil.readInt(m_stream);
m_strings = StringBlock.read(new ExtDataInput((DataInput) new LittleEndianDataInputStream(m_stream)));
ReadUtil.readCheckType(m_stream, RESOURCEIDS_CHUNK_TYPE);
int chunkSize = ReadUtil.readInt(m_stream);
if (chunkSize < 8 || (chunkSize % 4) != 0) {
throw new IOException("Invalid resource ids size (" + chunkSize + ").");
}
m_resourceIDs = ReadUtil.readIntArray(m_stream, chunkSize / 4 - 2);
resetState();
}
示例3: readBlocks
import com.google.common.io.LittleEndianDataInputStream; //导入依赖的package包/类
public void readBlocks(InputStream is, int nBlocks) throws IOException {
LittleEndianDataInputStream lis = new LittleEndianDataInputStream(is);
for (int i = 0; i < nBlocks; i++) {
int compressionMethod = lis.read();
int contentType = lis.read();
int contentId = ITF8.readUnsignedITF8(lis);
int size = ITF8.readUnsignedITF8(lis);
int rawSize = ITF8.readUnsignedITF8(lis);
byte[] blockData = new byte[size];
lis.readFully(blockData);
blockData = uncompress(blockData, compressionMethod);
String tmp = new String(blockData);
if (major >= 3) {
int checksum = CramInt.int32(lis);
}
}
}
示例4: 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);
}
}
示例5: 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)
);
}
示例6: 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;
}
示例7: readObject
import com.google.common.io.LittleEndianDataInputStream; //导入依赖的package包/类
private void readObject(LittleEndianDataInputStream stream, Tile tile) throws IOException {
int pos = stream.read();
int type = stream.read();
if (pos==2 || pos==10) {
WallData wallData = WAKData.walls.get(type);
if (pos==2) {
Tile t = getTile(tile, 0, 1);
if (t!=null) {
t.setHorizontalWall(wallData, 0, false);
}
}
if (pos==10) {
tile.setVerticalWall(wallData, 0, false);
}
stream.skipBytes(1);
}
else {
ObjectLocation loc = WAKData.locations.get(pos);
GameObjectData data = WAKData.objects.get(type);
if (data!=null) {
tile.setGameObject(data, loc, 0);
}
stream.skipBytes(1);
}
}
示例8: skipTimeIndependentData
import com.google.common.io.LittleEndianDataInputStream; //导入依赖的package包/类
/**
* @param dataStream
* @throws IOException
*/
private void skipTimeIndependentData(LittleEndianDataInputStream dataStream)
throws IOException {
header = BinaryHeaderDAO.readData(dataStream);
// System.out.println(header.getModelAndVersion());
// System.out.println("Fileversion: " + header.getFileversion());
ComponentData compData = ComponentDataDAO.readData(dataStream,
header.getFileversion());
SpecieDataDAO.readData(dataStream);
dataStream.skip(24); // other stuff
releaseSiteData = ReleaseSiteDataDAO.readData(dataStream);
ReleaseDataDAO.readData(dataStream, releaseSiteData.getNumberSites(),
compData.getTotalNumberOfComponents());
expandingGrid = (dataStream.readShort() == 1);
dataStream.skip(6); // more other stuff
ResponseDataDAO.readData(dataStream);
}
示例9: readData
import com.google.common.io.LittleEndianDataInputStream; //导入依赖的package包/类
/**
* Create releaseSite from data read from dataStream
*
* @param dataStream
* @throws IOException
*/
public static ReleaseSite readData(
LittleEndianDataInputStream dataStream) throws IOException {
ReleaseSite data = new ReleaseSite();
data.longitude = dataStream.readDouble();
data.latitude = dataStream.readDouble();
data.depth = dataStream.readDouble();
data.bathymetry = dataStream.readDouble();
data.releaseDiameter = dataStream.readDouble();
data.startTime = dataStream.readDouble();
data.duration = dataStream.readDouble();
data.moving = dataStream.readShort();
return data;
}
示例10: readData
import com.google.common.io.LittleEndianDataInputStream; //导入依赖的package包/类
/**
*
* @param dataStream
* @param numberSites
* @param numberComponentsInProfile
* @throws IOException
*/
public static ReleaseData readData(
LittleEndianDataInputStream dataStream, int numberSites,
int numberComponentsInProfile) throws IOException {
ReleaseData data = new ReleaseData();
if (numberSites > 0) {
Vector<Release> releases = new Vector<Release>();
for (int i = 0; i < numberSites; i++) {
releases.add(new Release(dataStream,
numberComponentsInProfile));
}
data.releases = releases;
}
return data;
}
示例11: 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;
}
示例12: readData
import com.google.common.io.LittleEndianDataInputStream; //导入依赖的package包/类
/**
* Read SpecieData from dataStream
*
* @param dataStream
* @throws IOException
*/
public static SpecieData readData(LittleEndianDataInputStream dataStream)
throws IOException {
SpecieData data = new SpecieData();
short numberSpecies = dataStream.readShort();
if (numberSpecies > 0) {
Vector<Specie> species = new Vector<Specie>();
for (int i = 0; i < numberSpecies; i++) {
species.add(SpecieDAO.readData(dataStream));
}
data.species = species;
}
return data;
}
示例13: readData
import com.google.common.io.LittleEndianDataInputStream; //导入依赖的package包/类
/**
*
* @param datastream
* @param numberOfLayers
* @return
* @throws IOException
*/
public static SubsurfaceGridDimensions readData(
LittleEndianDataInputStream datastream, short numberOfLayers)
throws IOException {
SubsurfaceGridDimensions data = new SubsurfaceGridDimensions();
data.cellHeightPerLayer = new Vector<Float>();
data.numberWatConcCellsPerLayer = new Vector<Integer>();
for (short i = 0; i < numberOfLayers; i++) {
data.cellHeightPerLayer.add(datastream.readFloat());
}
// additional mean and max layer
for (short i = 0; i < numberOfLayers + 2; i++) {
data.numberWatConcCellsPerLayer.add(datastream.readInt());
}
return data;
}
示例14: preProcess
import com.google.common.io.LittleEndianDataInputStream; //导入依赖的package包/类
@Override
public void preProcess() throws IOException {
validateFileLock();
fileHeader = new LibpcapGlobalHeader(getStream());
if (fileHeader.isSwapped()) {
this.reader = new LittleEndianDataInputStream(getStream());
} else {
this.reader = new DataInputStream(getStream());
}
}
示例15: 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;
}