本文整理汇总了Java中java.io.DataInputStream.readFloat方法的典型用法代码示例。如果您正苦于以下问题:Java DataInputStream.readFloat方法的具体用法?Java DataInputStream.readFloat怎么用?Java DataInputStream.readFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.DataInputStream
的用法示例。
在下文中一共展示了DataInputStream.readFloat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import java.io.DataInputStream; //导入方法依赖的package包/类
public static boolean load() {
if( loaded ) return true;
try {
URL url = URLFactory.url(haxby.map.MapApp.TEMP_BASE_URL + "arctic/ice/o18wobs.bin");
DataInputStream in = new DataInputStream(url.openStream());
o18 = new float[46][72];
for( int y=0 ; y<46 ; y++ ) {
for(int x=0 ; x<72 ; x++ ) {
o18[y][x] = in.readFloat();
}
}
loaded = true;
} catch (IOException ex) {
o18=null;
loaded = false;
}
return loaded;
}
示例2: doReadFloatArray
import java.io.DataInputStream; //导入方法依赖的package包/类
private static float[] doReadFloatArray(final DataInputStream dataInputStream) throws IOException {
final int length = dataInputStream.readInt();
final float[] array = new float[length];
for(int i = 0; i < length; i++) {
array[i] = dataInputStream.readFloat();
}
return array;
}
示例3: readPacket
import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
protected void readPacket(DataInputStream in) throws IOException {
this.username = in.readUTF();
this.targetX = in.readFloat();
this.targetY = in.readFloat();
this.isPrimaryPointer = in.readBoolean();
}
示例4: load
import java.io.DataInputStream; //导入方法依赖的package包/类
static void load() throws IOException {
q = new float[11][130][102];
URL url = URLFactory.url(haxby.map.MapApp.TEMP_BASE_URL + "arctic/ice/heatflux");
DataInputStream in = new DataInputStream(url.openStream());
for( int year=0 ; year<11 ; year++ ) {
for(int y=0 ; y<102 ; y++) {
for(int x=0 ; x<130 ; x++) {
q[year][x][y] = in.readFloat();
}
}
}
in.close();
loaded = true;
}
示例5: read
import java.io.DataInputStream; //导入方法依赖的package包/类
public void read(DataInputStream paramDataInputStream) throws IOException {
this.iTag = paramDataInputStream.readByte();
switch (this.iTag) {
case 7:
this.iNameIndex = paramDataInputStream.readUnsignedShort();
break;
case 8:
this.iStringIndex = paramDataInputStream.readUnsignedShort();
break;
case 9:
case 10:
case 11:
this.iClassIndex = paramDataInputStream.readUnsignedShort();
this.iNameAndTypeIndex = paramDataInputStream.readUnsignedShort();
break;
case 3:
this.iIntValue = paramDataInputStream.readInt();
break;
case 4:
this.fFloatVal = paramDataInputStream.readFloat();
break;
case 12:
this.iNameIndex = paramDataInputStream.readUnsignedShort();
this.iDescriptorIndex = paramDataInputStream.readUnsignedShort();
break;
case 5:
this.lLongVal = paramDataInputStream.readLong();
break;
case 6:
this.dDoubleVal = paramDataInputStream.readDouble();
break;
case 1:
this.sUTFStr = paramDataInputStream.readUTF();
break;
case 2:
default:
System.out.println("Unknown constant pool type: " + this.iTag);
}
}
示例6: onReceive
import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void onReceive(int length, DataInputStream in) throws IOException {
x = in.readDouble();
y = in.readDouble();
z = in.readDouble();
yaw = in.readFloat();
pitch = in.readFloat();
onGround = in.readBoolean();
}
示例7: parse
import java.io.DataInputStream; //导入方法依赖的package包/类
public static ConstantPool parse(byte[] bytes, String description) {
List<ConstantPool.Entry> entries = new ArrayList<ConstantPool.Entry>();
DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));
entries.add(new EntryNULL());
try {
do {
byte tagByte;
try {
tagByte = in.readByte();
} catch (EOFException eof) {
break;
}
ConstantPool.Entry entry;
switch(tagByte) {
case TAG_UTF8:
entry = new EntryUTF8(in.readUTF());
break;
case TAG_INTEGER:
entry = new EntryInteger(in.readInt());
break;
case TAG_LONG:
entry = new EntryLong(in.readLong());
entries.add(entry);
entry = new EntryNULL(); // Long takes TWO constant pool entries!?!
break;
case TAG_FLOAT:
entry = new EntryFloat(in.readFloat());
break;
case TAG_DOUBLE:
entry = new EntryDouble(in.readDouble());
entries.add(entry);
entry = new EntryNULL(); // Double takes TWO constant pool entries!?!
break;
case TAG_CLASS:
entry = new EntryClass(in.readShort());
break;
case TAG_STRING:
entry = new EntryString(in.readShort());
break;
case TAG_NAMETYPE:
entry = new EntryNameType(in.readShort(), in.readShort());
break;
case TAG_FIELDREF:
case TAG_METHODREF:
case TAG_INTERFACEREF:
entry = new EntryFieldMethodRef(tagByte, in.readShort(), in.readShort());
break;
case TAG_METHODHANDLE:
entry = new EntryMethodHandle(in);
break;
case TAG_METHODTYPE:
entry = new EntryMethodType(in);
break;
case TAG_INVOKEDYNAMIC:
entry = new EntryInvokeDynamic(in);
break;
case TAG_MODULE:
entry = new EntryModule(in.readShort());
break;
case TAG_PACKAGE:
entry = new EntryPackage(in.readShort());
break;
case 0:
default:
Logger.getLogger(ConstantPool.class.getName()).warning("Unknown tag byte: "+tagByte);
entry = new EntryNULL();
}
entries.add(entry);
} while(true);
} catch (IOException ioex) {
// Should not occur
Exceptions.printStackTrace(ioex);
}
return new ConstantPool(entries, description);
}
示例8: readFromStream
import java.io.DataInputStream; //导入方法依赖的package包/类
public void readFromStream(DataInputStream in) throws IOException {
super.readFromStream(in);
int len = in.readInt();
nTrackedAllocObjects = new long[len];
for (int i = 0; i < len; i++) {
nTrackedAllocObjects[i] = in.readLong();
}
len = in.readInt();
nTrackedLiveObjects = new int[len];
for (int i = 0; i < len; i++) {
nTrackedLiveObjects[i] = in.readInt();
}
len = in.readInt();
maxSurvGen = new int[len];
for (int i = 0; i < len; i++) {
maxSurvGen[i] = in.readInt();
}
len = in.readInt();
trackedLiveObjectsSize = new long[len];
for (int i = 0; i < len; i++) {
trackedLiveObjectsSize[i] = in.readLong();
}
len = in.readInt();
avgObjectAge = new float[len];
for (int i = 0; i < len; i++) {
avgObjectAge[i] = in.readFloat();
}
nInstrClasses = in.readInt();
len = in.readInt();
nTotalAllocObjects = new int[len];
for (int i = 0; i < len; i++) {
nTotalAllocObjects[i] = in.readInt();
}
nTrackedItems = in.readInt();
maxValue = in.readLong();
nTotalTrackedBytes = in.readLong();
nTotalTracked = in.readInt();
currentEpoch = in.readInt();
}
示例9: read
import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void read(DataInputStream stream) throws IOException{
power = stream.readFloat();
}
示例10: read
import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void read(DataInputStream stream) throws IOException{
super.read(stream);
heat = stream.readFloat();
}
示例11: read
import java.io.DataInputStream; //导入方法依赖的package包/类
public Object read(DataInputStream in) throws IOException
{
return in.readFloat();
}
示例12: readContantsInClass
import java.io.DataInputStream; //导入方法依赖的package包/类
private static void readContantsInClass(InputStream is, StringBuilder sb) throws IOException {
DataInputStream dis = new DataInputStream(is);
int magic = 0xCAFEBABE;
if (!(magic == dis.readInt())) {
dis.close();
return;
}
dis.readShort(); //minor_version
dis.readShort();//major_version
int constant_pool_count = dis.readShort();
/* 常量池中数据项类型 类型标志 类型描述
CONSTANT_Utf8 1 UTF-8编码的Unicode字符串
CONSTANT_Integer 3 int类型字面值
CONSTANT_Float 4 float类型字面值
CONSTANT_Long 5 long类型字面值
CONSTANT_Double 6 double类型字面值
CONSTANT_Class 7 对一个类或接口的符号引用
CONSTANT_String 8 String类型字面值
CONSTANT_Fieldref 9 对一个字段的符号引用
CONSTANT_Methodref 10 对一个类中声明的方法的符号引用
CONSTANT_InterfaceMethodref 11 对一个接口中声明的方法的符号引用
CONSTANT_NameAndType 12 对一个字段或方法的部分符号引用
*/
for (int i = 1; i < constant_pool_count; i++) { // 常量池
int tag = dis.readByte();
switch (tag) {
case 1: //CONSTANT_Utf8
short len = dis.readShort();
if (len < 0) {
System.out.println("len " + len);
continue;
}
byte[] bs = new byte[len];
dis.read(bs);
pln(new String(bs), sb);
continue;
case 3: //CONSTANT_Integer
int v_int = dis.readInt();
pln(v_int, sb);
continue;
case 4: //CONSTANT_Float
float v_float = dis.readFloat();
pln(v_float, sb);
continue;
case 5: //CONSTANT_Long
long v_long = dis.readLong();
pln(v_long, sb);
continue;
case 6: //CONSTANT_Double
double v_double = dis.readDouble();
pln(v_double, sb);
continue;
case 7: //CONSTANT_String
dis.readShort();
continue;
case 8: //CONSTANT_String
dis.readShort();
continue;
case 9: //CONSTANT_Fieldref_info
dis.readShort(); //指向一个CONSTANT_Class_info数据项
dis.readShort(); //指向一个CONSTANT_NameAndType_info
continue;
case 10: //CONSTANT_Methodref_info
dis.readShort(); //指向一个CONSTANT_Class_info数据项
dis.readShort(); //指向一个CONSTANT_NameAndType_info
continue;
case 11: //CONSTANT_InterfaceMethodref_info
dis.readShort(); //指向一个CONSTANT_Class_info数据项
dis.readShort(); //指向一个CONSTANT_NameAndType_info
continue;
case 12:
dis.readShort();
dis.readShort();
continue;
default:
return;
}
}
}
示例13: read
import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void read(DataInputStream dataInputStream) throws Exception {
progress = dataInputStream.readFloat();
}
示例14: stream
import java.io.DataInputStream; //导入方法依赖的package包/类
public static Vector3 stream(DataInputStream dataInputStream) throws IOException {
return new Vector3(dataInputStream.readFloat(), dataInputStream.readFloat(), dataInputStream.readFloat());
}
示例15: read
import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void read(DataInputStream input) throws IOException {
value = input.readFloat();
}