本文整理汇总了Java中java.io.DataInputStream.readDouble方法的典型用法代码示例。如果您正苦于以下问题:Java DataInputStream.readDouble方法的具体用法?Java DataInputStream.readDouble怎么用?Java DataInputStream.readDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.DataInputStream
的用法示例。
在下文中一共展示了DataInputStream.readDouble方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadVarMapping
import java.io.DataInputStream; //导入方法依赖的package包/类
private StringMapping loadVarMapping(ZipFile zf, String varName) throws IOException {
InputStream zis = zf.getInputStream(new ZipEntry(varName + "_Map" + JwatSession.BINext));
//System.out.println("Entry " + varName+"_Map"+JwatSession.BINext);
DataInputStream dis = new DataInputStream(zis);
StringMapping map = new StringMapping();
double val;
String str;
int numEl = dis.read();
for (int i = 0; i < numEl; i++) {
val = dis.readDouble();
str = dis.readUTF();
map.addNewMapping(val, str);
}
return map;
}
示例2: readState
import java.io.DataInputStream; //导入方法依赖的package包/类
/** Reads the entire state of the MersenneTwister RNG from the stream. */
public synchronized void readState(DataInputStream stream) throws IOException {
int len = mt.length;
for (int x = 0; x < len; x++) {
mt[x] = stream.readInt();
}
len = mag01.length;
for (int x = 0; x < len; x++) {
mag01[x] = stream.readInt();
}
mti = stream.readInt();
nextNextGaussian = stream.readDouble();
haveNextNextGaussian = stream.readBoolean();
}
示例3: readFromStream
import java.io.DataInputStream; //导入方法依赖的package包/类
public void readFromStream(DataInputStream in) throws IOException {
threadId = in.readInt();
threadName = in.readUTF();
collectingTwoTimeStamps = in.readBoolean();
int len = in.readInt();
compactData = new byte[len];
if (compactData.length > 0xFFFFFF) {
childOfsSize = CHILD_OFS_SIZE_4;
} else {
childOfsSize = CHILD_OFS_SIZE_3;
}
in.readFully(compactData);
nodeSize = in.readInt();
wholeGraphGrossTimeAbs = in.readLong();
wholeGraphGrossTimeThreadCPU = in.readLong();
timeInInjectedCodeInAbsCounts = in.readDouble();
timeInInjectedCodeInThreadCPUCounts = in.readDouble();
wholeGraphPureTimeAbs = in.readLong();
wholeGraphPureTimeThreadCPU = in.readLong();
wholeGraphNetTime0 = in.readLong();
wholeGraphNetTime1 = in.readLong();
totalInvNo = in.readLong();
displayWholeThreadCPUTime = in.readBoolean();
rootNode = new PrestimeCPUCCTNodeBacked(this, null, 0);
if (this.getMethodIdForNodeOfs(0) == 0) {
rootNode.setThreadNode();
}
}
示例4: parseLUT
import java.io.DataInputStream; //导入方法依赖的package包/类
public void parseLUT() {
try {
DataInputStream lutdis = new DataInputStream(new ByteArrayInputStream(lut));
numberOfElements = (int) lutdis.readDouble();
pcl = lutdis.readDouble();
nnu = lutdis.readDouble();
std[0] = lutdis.readDouble();
std[1] = lutdis.readDouble();
standardDeviation2ClippingThresh = new double[numberOfElements];
clippedStandardDeviation2Threshs = new double[2][numberOfElements];
for (int i = 0; i < numberOfElements; i++) {
standardDeviation2ClippingThresh[i] = lutdis.readDouble();
}
clippedStd[0] = lutdis.readDouble();
clippedStd[1] = lutdis.readDouble();
for (int i = 0; i < numberOfElements; i++) {
clippedStandardDeviation2Threshs[CLIPPINGTRESH][i] = lutdis.readDouble();
}
for (int i = 0; i < numberOfElements; i++) {
clippedStandardDeviation2Threshs[DETECTIONTRESH][i] = lutdis.readDouble();
}
} catch (java.io.IOException e) {
System.out.println("Cannot read the tables");
}
this.step = (numberOfElements - 1) / (std[1] - std[0]);
this.clippedStep = (numberOfElements - 1) / (clippedStd[1] - clippedStd[0]);
return;
}
示例5: read
import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void read(DataInputStream input) throws IOException {
double x = input.readDouble();
double y = input.readDouble();
double z = input.readDouble();
setValue(new BlockVector(x, y, z));
}
示例6: read
import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void read(DataInputStream input) throws IOException {
double x = input.readDouble();
double y = input.readDouble();
double z = input.readDouble();
setValue(new EulerAngle(x, y, z));
}
示例7: read
import java.io.DataInputStream; //导入方法依赖的package包/类
@Override
public void read(DataInputStream input) throws IOException {
double x = input.readDouble();
double y = input.readDouble();
double z = input.readDouble();
setValue(new Vector(x, y, z));
}
示例8: 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);
}
}
示例9: 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();
}
示例10: 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);
}
示例11: loadKmeanResult
import java.io.DataInputStream; //导入方法依赖的package包/类
private KMean loadKmeanResult(int numCluster, int varSelLst[], String fileName, ZipFile zf) throws IOException {
ClusteringInfosKMean curInfo[];
int i, j, k;
int curNumCluster;
MatrixObservations m = waSession.getDataModel().getMatrix();
int numvars = m.getNumVariables();
int numoss = m.getNumOfObs();
DataInputStream dis = new DataInputStream(zf.getInputStream(new ZipEntry(fileName)));
short asseg[][];
//init result vector
curInfo = new ClusteringInfosKMean[numCluster];
asseg = new short[numCluster][numoss];
//System.out.println("Loading kMeans Results "+fileName);
for (i = 0; i < numCluster; i++) {
curNumCluster = dis.readInt();
curInfo[i] = new ClusteringInfosKMean(curNumCluster - 1, numvars);
curInfo[i].omsr = dis.readDouble();
curInfo[i].ratio = dis.readDouble();
for (k = 0; k < curNumCluster; k++) {
curInfo[i].infoCluster[k] = new ClusterInfoKMean(numvars);
curInfo[i].infoCluster[k].numOss = dis.readInt();
for (j = 0; j < numvars; j++) {
curInfo[i].infoCluster[k].percVar[j] = dis.readDouble();
curInfo[i].infoCluster[k].statClust[j].iNotZr = dis.readInt();
curInfo[i].infoCluster[k].statClust[j].dMedia = dis.readDouble();
curInfo[i].infoCluster[k].statClust[j].dStdEr = dis.readDouble();
curInfo[i].infoCluster[k].statClust[j].dStdDv = dis.readDouble();
curInfo[i].infoCluster[k].statClust[j].dVarnz = dis.readDouble();
curInfo[i].infoCluster[k].statClust[j].dKurto = dis.readDouble();
curInfo[i].infoCluster[k].statClust[j].dSkewn = dis.readDouble();
curInfo[i].infoCluster[k].statClust[j].dRange = dis.readDouble();
curInfo[i].infoCluster[k].statClust[j].dMaxOs = dis.readDouble();
curInfo[i].infoCluster[k].statClust[j].dMinOs = dis.readDouble();
}
}
for (k = 0; k < numoss; k++) {
asseg[i][k] = dis.readShort();
}
}
return new KMean(curInfo, varSelLst, asseg);
}
示例12: loadFuzzyResult
import java.io.DataInputStream; //导入方法依赖的package包/类
private FuzzyKMean loadFuzzyResult(int numCluster, int varSelLst[], String fileName, ZipFile zf) throws IOException {
ClusteringInfosFuzzy curInfo[];
int i, j, k;
int curNumCluster;
MatrixObservations m = waSession.getDataModel().getMatrix();
int numvars = m.getNumVariables();
int numoss = m.getNumOfObs();
DataInputStream dis = new DataInputStream(zf.getInputStream(new ZipEntry(fileName)));
double asseg[][];
double entropy[];
double error;
ClusterInfoFuzzy infoCluster[];
FuzzyKMean fkm = new FuzzyKMean(numCluster + 1, varSelLst);
//init result vector
curInfo = new ClusteringInfosFuzzy[numCluster];
entropy = new double[numCluster];
//System.out.println("Loading Fuzzy kMeans Results "+fileName);
for (i = 0; i < numCluster; i++) {
curNumCluster = dis.readInt();
entropy[i] = dis.readDouble();
error = dis.readDouble();
infoCluster = new ClusterInfoFuzzy[curNumCluster];
if (error != -1) {
for (k = 0; k < curNumCluster; k++) {
infoCluster[k] = new ClusterInfoFuzzy(numvars);
infoCluster[k].numOss = dis.readInt();
for (j = 0; j < numvars; j++) {
infoCluster[k].percVar[j] = dis.readDouble();
infoCluster[k].statClust[j].iNotZr = dis.readInt();
infoCluster[k].statClust[j].dMedia = dis.readDouble();
infoCluster[k].statClust[j].dStdEr = dis.readDouble();
infoCluster[k].statClust[j].dStdDv = dis.readDouble();
infoCluster[k].statClust[j].dVarnz = dis.readDouble();
infoCluster[k].statClust[j].dKurto = dis.readDouble();
infoCluster[k].statClust[j].dSkewn = dis.readDouble();
infoCluster[k].statClust[j].dRange = dis.readDouble();
infoCluster[k].statClust[j].dMaxOs = dis.readDouble();
infoCluster[k].statClust[j].dMinOs = dis.readDouble();
}
}
}
int nel;
asseg = new double[curNumCluster][numoss];
for (k = 0; k < curNumCluster; k++) {
//nel=dis.readInt();
for (j = 0; j < numoss; j++) {
asseg[k][j] = dis.readDouble();
}
}
fkm.setAssign(i, asseg);
curInfo[i] = (ClusteringInfosFuzzy) fkm.getClusteringInfos(i);
curInfo[i].infoCluster = infoCluster;
curInfo[i].setError(m, error);
}
fkm.setEntropy(entropy);
return fkm;
}
示例13: read
import java.io.DataInputStream; //导入方法依赖的package包/类
public Object read(DataInputStream in) throws IOException
{
return in.readDouble();
}
示例14: BinaryConstantPool
import java.io.DataInputStream; //导入方法依赖的package包/类
/**
* Constructor
*/
BinaryConstantPool(DataInputStream in) throws IOException {
// JVM 4.1 ClassFile.constant_pool_count
types = new byte[in.readUnsignedShort()];
cpool = new Object[types.length];
for (int i = 1 ; i < cpool.length ; i++) {
int j = i;
// JVM 4.4 cp_info.tag
switch(types[i] = in.readByte()) {
case CONSTANT_UTF8:
cpool[i] = in.readUTF();
break;
case CONSTANT_INTEGER:
cpool[i] = in.readInt();
break;
case CONSTANT_FLOAT:
cpool[i] = new Float(in.readFloat());
break;
case CONSTANT_LONG:
cpool[i++] = in.readLong();
break;
case CONSTANT_DOUBLE:
cpool[i++] = new Double(in.readDouble());
break;
case CONSTANT_CLASS:
case CONSTANT_STRING:
// JVM 4.4.3 CONSTANT_String_info.string_index
// or JVM 4.4.1 CONSTANT_Class_info.name_index
cpool[i] =in.readUnsignedShort();
break;
case CONSTANT_FIELD:
case CONSTANT_METHOD:
case CONSTANT_INTERFACEMETHOD:
case CONSTANT_NAMEANDTYPE:
// JVM 4.4.2 CONSTANT_*ref_info.class_index & name_and_type_index
cpool[i] = (in.readUnsignedShort() << 16) | in.readUnsignedShort();
break;
case CONSTANT_METHODHANDLE:
cpool[i] = readBytes(in, 3);
break;
case CONSTANT_METHODTYPE:
cpool[i] = readBytes(in, 2);
break;
case CONSTANT_INVOKEDYNAMIC:
cpool[i] = readBytes(in, 4);
break;
case 0:
default:
throw new ClassFormatError("invalid constant type: " + (int)types[i]);
}
}
}
示例15: 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;
}
}
}