@Override public void readObject(DataInput in) throws IOException { super.readObject(in); ((PositionInterpolator) node).setStartPosition(in.readFloat()); ((PositionInterpolator) node).setEndPosition(in.readFloat()); }
/** Abstract. Reads the raw packet data from the data stream. */ public void readPacketData(DataInput par1DataInput) throws IOException { this.xPosition = par1DataInput.readDouble(); this.yPosition = par1DataInput.readDouble(); this.stance = par1DataInput.readDouble(); this.zPosition = par1DataInput.readDouble(); this.yaw = par1DataInput.readFloat(); this.pitch = par1DataInput.readFloat(); super.readPacketData(par1DataInput); }
public void readObject(DataInput in) throws IOException { super.readObject(in); Texture attr = (Texture) node; attr.setBoundaryColor(control.readColor4f(in)); attr.setBoundaryModeS(in.readInt()); attr.setBoundaryModeT(in.readInt()); attr.setEnable(in.readBoolean()); imageComponents = new int[in.readInt()]; for (int i = 0; i < imageComponents.length; i++) imageComponents[i] = in.readInt(); int mag = in.readInt(); try { attr.setMagFilter(mag); } catch (IllegalArgumentException e) { // The OpenFLT loader sets erroneous values for // mag filter which will cause an exception with // Java3D 1.3, handle this gracefully.... if (mag == Texture.MULTI_LEVEL_LINEAR) attr.setMagFilter(Texture.BASE_LEVEL_LINEAR); else if (mag == Texture.MULTI_LEVEL_POINT) attr.setMagFilter(Texture.BASE_LEVEL_POINT); else attr.setMagFilter(Texture.FASTEST); } attr.setMinFilter(in.readInt()); attr.setBaseLevel(in.readInt()); attr.setMaximumLevel(in.readInt()); attr.setMinimumLOD(in.readFloat()); attr.setMaximumLOD(in.readFloat()); attr.setLodOffset(control.readPoint3f(in)); attr.setAnisotropicFilterMode(in.readInt()); attr.setAnisotropicFilterDegree(in.readFloat()); int points = in.readInt(); if (points > 0) { float[] lod = new float[points]; float[] pts = new float[points]; for (int i = 0; i < points; i++) { lod[i] = in.readFloat(); pts[i] = in.readFloat(); } attr.setSharpenTextureFunc(lod, pts); } points = in.readInt(); if (points >= 4) { float[] weights = new float[points]; for (int i = 0; i < points; i++) { weights[i] = in.readFloat(); } attr.setFilter4Func(weights); } }
@Override public void readFields(DataInput in) throws IOException { isSingleton = in.readBoolean(); if (isSingleton) { singletonIndex = in.readInt(); singletonValue = in.readFloat(); } else { int size = in.readInt(); for (int i = 0; i < size; ++i) { entries.add(in.readFloat()); } } }
private static Object loadTyped(final DataInput in) { try { switch (in.readByte()) { case STRING: return RW.readUTF(in); case NONE: return null; case INTEGER: return DataInputOutputUtil.readINT(in); case LONG: return in.readLong(); case FLOAT: return in.readFloat(); case DOUBLE: return in.readDouble(); case TYPE: return Type.getType(RW.readUTF(in)); } } catch (IOException e) { throw new BuildDataCorruptedException(e); } assert (false); return null; }
@Override public void readFields(DataInput in) throws IOException { initialize(); int numFields = in.readInt(); for (int i = 0; i < numFields; ++i) { byte type = in.readByte(); if (type == BYTE) { fields.add(in.readByte()); } else if (type == BOOLEAN) { fields.add(in.readBoolean()); } else if (type == INT) { fields.add(in.readInt()); } else if (type == LONG) { fields.add(in.readLong()); } else if (type == FLOAT) { fields.add(in.readFloat()); } else if (type == DOUBLE) { fields.add(in.readDouble()); } else if (type == STRING) { fields.add(in.readUTF()); } else if (type == BYTE_ARRAY) { int len = in.readShort(); byte[] bytes = new byte[len]; in.readFully(bytes); fields.add(bytes); } else { throw new IllegalArgumentException("Failed encoding, unknown element type in stream"); } } }
public Object readData(DataInput dataInput) throws IOException { if (!dataInput.readBoolean()) { return null; } float val = dataInput.readFloat(); return Float.valueOf(val); }
@Override public void readFields(DataInput in) throws IOException { int flags = in.readByte(); Preconditions.checkArgument( flags >> NUM_FLAGS == 0, "Unknown flags set: %d", Integer.toString(flags, 2)); boolean dense = (flags & FLAG_DENSE) != 0; boolean sequential = (flags & FLAG_SEQUENTIAL) != 0; boolean named = (flags & FLAG_NAMED) != 0; boolean laxPrecision = (flags & FLAG_LAX_PRECISION) != 0; int size = Varint.readUnsignedVarInt(in); Vector v; if (dense) { double[] values = new double[size]; for (int i = 0; i < size; i++) { values[i] = laxPrecision ? in.readFloat() : in.readDouble(); } v = new DenseVector(values); } else { int numNonDefaultElements = Varint.readUnsignedVarInt(in); v = sequential ? new SequentialAccessSparseVector(size, numNonDefaultElements) : new RandomAccessSparseVector(size, numNonDefaultElements); if (sequential) { int lastIndex = 0; for (int i = 0; i < numNonDefaultElements; i++) { int delta = Varint.readUnsignedVarInt(in); int index = lastIndex + delta; lastIndex = index; double value = laxPrecision ? in.readFloat() : in.readDouble(); v.setQuick(index, value); } } else { for (int i = 0; i < numNonDefaultElements; i++) { int index = Varint.readUnsignedVarInt(in); double value = laxPrecision ? in.readFloat() : in.readDouble(); v.setQuick(index, value); } } } if (named) { String name = in.readUTF(); v = new NamedVector(v, name); } vector = v; }
public DSParams(DataInput in) throws IOException { msec_per_frame = in.readInt(); x = in.readInt(); y = in.readInt(); width = in.readInt(); height = in.readInt(); zoom = in.readFloat(); }
@Override public float readFloat() { try { return input.readFloat(); } catch (IOException e) { throw new IllegalStateException(e); } }
@Override public void readConstructorParams(DataInput in) throws IOException { super.readConstructorParams(in); radius = in.readFloat(); height = in.readFloat(); xdivision = in.readInt(); ydivision = in.readInt(); }
@Override public void readObject(DataInput in) throws IOException { super.readObject(in); Sound sound = (Sound) node; sound.setContinuousEnable(in.readBoolean()); sound.setEnable(in.readBoolean()); sound.setInitialGain(in.readFloat()); sound.setLoop(in.readInt()); sound.setPriority(in.readFloat()); sound.setReleaseEnable(in.readBoolean()); boundingLeaf = in.readInt(); sound.setSchedulingBounds(control.readBounds(in)); mediaContainer = in.readInt(); sound.setMute(in.readBoolean()); sound.setPause(in.readBoolean()); sound.setRateScaleFactor(in.readFloat()); }
@Override public void readFields(DataInput in) throws IOException { progress = in.readFloat(); if (in.readBoolean()) { tezCounters = new TezCounters(); tezCounters.readFields(in); } if (in.readBoolean()) { statistics = new TaskStatistics(); statistics.readFields(in); } }
public void readConstructorParams(DataInput in) throws IOException { super.readConstructorParams(in); axisOfTranslation = control.readTransform3D(in); keyFrames = new KBKeyFrame[in.readInt()]; for (int i = 0; i < keyFrames.length; i++) { keyFrames[i] = new KBKeyFrame( in.readFloat(), in.readInt(), control.readPoint3f(in), in.readFloat(), in.readFloat(), in.readFloat(), control.readPoint3f(in), in.readFloat(), in.readFloat(), in.readFloat()); } }
@Override public void readFields(DataInput in) throws IOException { query = new BooleanQuery(in.readBoolean()); query.setBoost(in.readFloat()); query.setMinimumNumberShouldMatch(in.readInt()); int length = in.readInt(); for (int i = 0; i < length; i++) { BooleanClauseWritable booleanClauseWritable = new BooleanClauseWritable(); booleanClauseWritable.readFields(in); query.add(booleanClauseWritable.getBooleanClause()); } }
private Object[] processConstantPool(DataInput in, int size) throws IOException { Object[] constant_pool = new Object[size]; for (int i = 1; i < size; ++i) { // CP slot 0 is unused byte b = in.readByte(); switch (b) { case jq_ClassFileConstants.CONSTANT_Integer: in.readInt(); break; case jq_ClassFileConstants.CONSTANT_Float: in.readFloat(); break; case jq_ClassFileConstants.CONSTANT_Long: ++i; in.readLong(); break; case jq_ClassFileConstants.CONSTANT_Double: ++i; in.readDouble(); break; case jq_ClassFileConstants.CONSTANT_Utf8: { byte utf[] = new byte[in.readUnsignedShort()]; in.readFully(utf); constant_pool[i] = Utf8.get(utf); break; } case jq_ClassFileConstants.CONSTANT_Class: constant_pool[i] = new Integer(in.readUnsignedShort()); break; case jq_ClassFileConstants.CONSTANT_String: in.readUnsignedShort(); break; case jq_ClassFileConstants.CONSTANT_NameAndType: case jq_ClassFileConstants.CONSTANT_FieldRef: case jq_ClassFileConstants.CONSTANT_MethodRef: case jq_ClassFileConstants.CONSTANT_InterfaceMethodRef: in.readUnsignedShort(); in.readUnsignedShort(); break; default: throw new ClassFormatError("bad constant pool entry tag: entry=" + i + ", tag=" + b); } } return constant_pool; }
public void readFields(DataInput in) throws IOException { this.taskid.readFields(in); this.progress = in.readFloat(); this.runState = WritableUtils.readEnum(in, State.class); this.diagnosticInfo = Text.readString(in); this.stateString = Text.readString(in); this.phase = WritableUtils.readEnum(in, Phase.class); this.startTime = in.readLong(); this.finishTime = in.readLong(); counters = new Counters(); this.includeCounters = in.readBoolean(); this.outputSize = in.readLong(); if (includeCounters) { counters.readFields(in); } nextRecordRange.readFields(in); this.runOnGPU = in.readBoolean(); }
/** * Reads a primitive value of the specified class type from the stream. * * @param in A stream to read from. * @param cls A class type of the primitive. * @return A primitive. * @throws IOException If an I/O error occurs. */ static Object readPrimitive(DataInput in, Class cls) throws IOException { if (cls == byte.class) return in.readByte(); if (cls == short.class) return in.readShort(); if (cls == int.class) return in.readInt(); if (cls == long.class) return in.readLong(); if (cls == float.class) return in.readFloat(); if (cls == double.class) return in.readDouble(); if (cls == boolean.class) return in.readBoolean(); if (cls == char.class) return in.readChar(); throw new IllegalArgumentException(); }
public static List readWatchableObjects(DataInput par0DataInput) throws IOException { ArrayList arraylist = null; for (byte b0 = par0DataInput.readByte(); b0 != 127; b0 = par0DataInput.readByte()) { if (arraylist == null) { arraylist = new ArrayList(); } int i = (b0 & 224) >> 5; int j = b0 & 31; WatchableObject watchableobject = null; switch (i) { case 0: watchableobject = new WatchableObject(i, j, Byte.valueOf(par0DataInput.readByte())); break; case 1: watchableobject = new WatchableObject(i, j, Short.valueOf(par0DataInput.readShort())); break; case 2: watchableobject = new WatchableObject(i, j, Integer.valueOf(par0DataInput.readInt())); break; case 3: watchableobject = new WatchableObject(i, j, Float.valueOf(par0DataInput.readFloat())); break; case 4: watchableobject = new WatchableObject(i, j, Packet.readString(par0DataInput, 64)); break; case 5: watchableobject = new WatchableObject(i, j, Packet.readItemStack(par0DataInput)); break; case 6: int k = par0DataInput.readInt(); int l = par0DataInput.readInt(); int i1 = par0DataInput.readInt(); watchableobject = new WatchableObject(i, j, new ChunkCoordinates(k, l, i1)); } arraylist.add(watchableobject); } return arraylist; }
public void readFields(DataInput in) throws IOException { this.taskid.readFields(in); this.progress = in.readFloat(); this.state = Text.readString(in); this.startTime = in.readLong(); this.finishTime = in.readLong(); diagnostics = WritableUtils.readStringArray(in); counters = new Counters(); counters.readFields(in); currentStatus = WritableUtils.readEnum(in, TIPStatus.class); if (currentStatus == TIPStatus.RUNNING) { int num = WritableUtils.readVInt(in); for (int i = 0; i < num; i++) { TaskAttemptID t = new TaskAttemptID(); t.readFields(in); runningAttempts.add(t); } } else if (currentStatus == TIPStatus.COMPLETE) { successfulAttempt.readFields(in); } }
@Override public void readFields(DataInput in) throws IOException { containerState = AppWorkerContainerState.valueOf(in.readUTF()); progress = in.readFloat(); statusMessage = WritableUtils.readString(in); }
void readTagContents(DataInput datainput) throws IOException { floatValue = datainput.readFloat(); }
@Override public void readConstructorParams(DataInput in) throws IOException { super.readConstructorParams(in); String fontName = in.readUTF(); int style = in.readInt(); int size = in.readInt(); font = new Font(fontName, style, size); tesselationTolerance = in.readDouble(); GeneralPath shape = null; int segType = in.readInt(); while (segType != Integer.MIN_VALUE) { if (shape == null) shape = new GeneralPath(); if (segType == PathIterator.SEG_MOVETO) { shape.moveTo(in.readFloat(), in.readFloat()); } else if (segType == PathIterator.SEG_LINETO) { shape.lineTo(in.readFloat(), in.readFloat()); } else if (segType == PathIterator.SEG_QUADTO) { shape.quadTo(in.readFloat(), in.readFloat(), in.readFloat(), in.readFloat()); } else if (segType == PathIterator.SEG_CUBICTO) { shape.curveTo( in.readFloat(), in.readFloat(), in.readFloat(), in.readFloat(), in.readFloat(), in.readFloat()); } else if (segType == PathIterator.SEG_CLOSE) { shape.closePath(); } segType = in.readInt(); } if (shape != null) extrudePath = new FontExtrusion(shape, in.readDouble()); else extrudePath = null; }
@Override public GeohashCoords readValueFromDataInput(DataInput dis) throws IOException { return new GeohashCoords(dis.readInt(), dis.readFloat(), dis.readFloat()); }
public void readFields(DataInput in) throws IOException { url = Text.readString(in); score = in.readFloat(); }
public void readFields(DataInput in) throws IOException { super.readFields(in); score = in.readFloat(); }
public void readObject(DataInput in) throws IOException { super.readObject(in); ((SpotLight) node).setDirection(control.readVector3f(in)); ((SpotLight) node).setSpreadAngle(in.readFloat()); ((SpotLight) node).setConcentration(in.readFloat()); }
public float readFloat() throws IOException { return dataInput.readFloat(); }
public static NiftiHeader read(String fn) throws IOException { DataInput di; boolean le = littleEndian(fn); InputStream is = new FileInputStream(fn); if (fn.endsWith(".gz")) is = new GZIPInputStream(is); if (le) di = new LEDataInputStream(is); else di = new DataInputStream(is); NiftiHeader ds = new NiftiHeader(); ds.filename = fn; ds.little_endian = le; ds.sizeof_hdr = di.readInt(); byte[] bb = new byte[10]; di.readFully(bb, 0, 10); ds.data_type_string = new StringBuffer(new String(bb)); bb = new byte[18]; di.readFully(bb, 0, 18); ds.db_name = new StringBuffer(new String(bb)); ds.extents = di.readInt(); ds.session_error = di.readShort(); ds.regular = new StringBuffer(); ds.regular.append((char) (di.readUnsignedByte())); ds.dim_info = new StringBuffer(); ds.dim_info.append((char) (di.readUnsignedByte())); int fps_dim = (int) ds.dim_info.charAt(0); ds.freq_dim = (short) (fps_dim & 3); ds.phase_dim = (short) ((fps_dim >>> 2) & 3); ds.slice_dim = (short) ((fps_dim >>> 4) & 3); for (int i = 0; i < 8; i++) ds.dim[i] = di.readShort(); if (ds.dim[0] > 0) ds.dim[1] = ds.dim[1]; if (ds.dim[0] > 1) ds.dim[2] = ds.dim[2]; if (ds.dim[0] > 2) ds.dim[3] = ds.dim[3]; if (ds.dim[0] > 3) ds.dim[4] = ds.dim[4]; for (int i = 0; i < 3; i++) ds.intent[i] = di.readFloat(); ds.intent_code = di.readShort(); ds.datatype = di.readShort(); ds.bitpix = di.readShort(); ds.slice_start = di.readShort(); for (int i = 0; i < 8; i++) ds.pixdim[i] = di.readFloat(); ds.qfac = (short) Math.floor((double) (ds.pixdim[0])); ds.vox_offset = di.readFloat(); ds.scl_slope = di.readFloat(); ds.scl_inter = di.readFloat(); ds.slice_end = di.readShort(); ds.slice_code = (byte) di.readUnsignedByte(); ds.xyzt_units = (byte) di.readUnsignedByte(); int unit_codes = (int) ds.xyzt_units; ds.xyz_unit_code = (short) (unit_codes & 007); ds.t_unit_code = (short) (unit_codes & 070); ds.cal_max = di.readFloat(); ds.cal_min = di.readFloat(); ds.slice_duration = di.readFloat(); ds.toffset = di.readFloat(); ds.glmax = di.readInt(); ds.glmin = di.readInt(); bb = new byte[80]; di.readFully(bb, 0, 80); ds.descrip = new StringBuffer(new String(bb)); bb = new byte[24]; di.readFully(bb, 0, 24); ds.aux_file = new StringBuffer(new String(bb)); ds.qform_code = di.readShort(); ds.sform_code = di.readShort(); for (int i = 0; i < 3; i++) ds.quatern[i] = di.readFloat(); for (int i = 0; i < 3; i++) ds.qoffset[i] = di.readFloat(); for (int i = 0; i < 4; i++) ds.srow_x[i] = di.readFloat(); for (int i = 0; i < 4; i++) ds.srow_y[i] = di.readFloat(); for (int i = 0; i < 4; i++) ds.srow_z[i] = di.readFloat(); bb = new byte[16]; di.readFully(bb, 0, 16); ds.intent_name = new StringBuffer(new String(bb)); bb = new byte[4]; di.readFully(bb, 0, 4); ds.magic = new StringBuffer(new String(bb)); di.readFully(ds.extension, 0, 4); if (ds.extension[0] != (byte) 0) { int start_addr = NiftiHeader.ANZ_HDR_SIZE + 4; while (start_addr < (int) ds.vox_offset) { int[] size_code = new int[2]; size_code[0] = di.readInt(); size_code[1] = di.readInt(); int nb = size_code[0] - NiftiHeader.EXT_KEY_SIZE; byte[] eblob = new byte[nb]; di.readFully(eblob, 0, nb); ds.extension_blobs.add(eblob); ds.extensions_list.add(size_code); start_addr += (size_code[0]); if (start_addr > (int) ds.vox_offset) throw new IOException( "Error: Data for extension " + (ds.extensions_list.size()) + " appears to overrun start of image data."); } } return ds; }
void read(DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException { sizeTracker.read(96L); this.data = input.readFloat(); }