本文整理匯總了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();
}