public PagedRangeCommand deserialize(DataInput in, int version) throws IOException { String keyspace = in.readUTF(); String columnFamily = in.readUTF(); long timestamp = in.readLong(); AbstractBounds<RowPosition> keyRange = AbstractBounds.serializer.deserialize(in, version).toRowBounds(); SliceQueryFilter predicate = SliceQueryFilter.serializer.deserialize(in, version); ByteBuffer start = ByteBufferUtil.readWithShortLength(in); ByteBuffer stop = ByteBufferUtil.readWithShortLength(in); int filterCount = in.readInt(); List<IndexExpression> rowFilter = new ArrayList<IndexExpression>(filterCount); for (int i = 0; i < filterCount; i++) { IndexExpression expr = new IndexExpression( ByteBufferUtil.readWithShortLength(in), IndexExpression.Operator.findByOrdinal(in.readInt()), ByteBufferUtil.readWithShortLength(in)); rowFilter.add(expr); } int limit = in.readInt(); return new PagedRangeCommand( keyspace, columnFamily, timestamp, keyRange, predicate, start, stop, rowFilter, limit); }
@Override public void readFields(DataInput dIn) throws IOException { instanceId = dIn.readUTF(); // Hadoop Configuration has to get its act right int len = dIn.readInt(); byte[] array = new byte[len]; dIn.readFully(array); ByteArrayInputStream bais = new ByteArrayInputStream(array); conf = new XConfiguration(bais); def = new LiteWorkflowApp(); def.readFields(dIn); status = Status.valueOf(dIn.readUTF()); int numExPaths = dIn.readInt(); for (int x = 0; x < numExPaths; x++) { String path = dIn.readUTF(); String nodeName = dIn.readUTF(); boolean isStarted = dIn.readBoolean(); NodeInstance nodeInstance = new NodeInstance(nodeName); nodeInstance.started = isStarted; executionPaths.put(path, nodeInstance); } int numVars = dIn.readInt(); for (int x = 0; x < numVars; x++) { String vName = dIn.readUTF(); String vVal = readBytesAsString(dIn); persistentVars.put(vName, vVal); } refreshLog(); }
@Override public ResultSetMetaData read(DataInput dataInput, ResultSetMetaData rsmd) throws IOException { int columnCount = dataInput.readInt(); StoredColumnMetaData[] columnMetaData = new StoredColumnMetaData[columnCount]; for (int column = 1; column <= columnCount; column++) columnMetaData[column - 1] = new StoredColumnMetaData( dataInput.readBoolean(), dataInput.readBoolean(), dataInput.readBoolean(), dataInput.readBoolean(), dataInput.readInt(), dataInput.readBoolean(), dataInput.readInt(), dataInput.readUTF(), dataInput.readUTF(), dataInput.readUTF(), dataInput.readInt(), dataInput.readInt(), dataInput.readUTF(), dataInput.readUTF(), dataInput.readInt(), dataInput.readUTF(), dataInput.readBoolean(), dataInput.readBoolean(), dataInput.readBoolean(), dataInput.readUTF()); return new ColumnMetaDataResultSetMetaData(columnMetaData); }
HistoryEntry(int version, DataInput in) throws IOException { if (version >= VERSION_1) { mBase = in.readUTF(); mEdited = in.readUTF(); } else { throw new IOException("invalid version " + version); } }
public void readData(DataInput in) throws IOException { name = in.readUTF(); initialPermits = in.readInt(); boolean hasFactory = in.readBoolean(); if (hasFactory) { factoryClassName = in.readUTF(); } }
public void readData(DataInput in) throws IOException { if (!in.readBoolean()) this.name = in.readUTF(); if (!in.readBoolean()) this.familyName = in.readUTF(); if (!in.readBoolean()) this.middleName = in.readUTF(); this.age = in.readInt(); this.active = in.readBoolean(); this.salary = in.readDouble(); }
/** * ************************************************************************ PAY ATTENTION: This * method is only internally used for message. [1] Row-Mutation (RowMutationSerializer) [2] * Query-Result (RowSerializer) * ************************************************************************ */ public ColumnFamily deserialize(DataInput dis) throws IOException { String cfName = dis.readUTF(); if (cfName.isEmpty()) return null; ColumnFamily cf = deserializeFromSSTableNoColumns( cfName, dis.readUTF(), readComparator(dis), readComparator(dis), dis); deserializeColumns(dis, cf); return cf; }
TVEditorial(DataInput in, byte ver, Map<Integer, Integer> idMap) throws IOException { super(in, ver, idMap); showID = readID(in, idMap); title = Wizard.getInstance().getTitleForID(readID(in, idMap)); network = Wizard.getInstance().getNetworkForID(readID(in, idMap)); airdate = in.readUTF(); description = in.readUTF(); imageURL = in.readUTF(); setMediaMask(MEDIA_MASK_TV); }
@Override public void readData(DataInput in) throws IOException { this.webServiceId = in.readUTF(); this.quantityId = in.readUTF(); this.timeStamp = in.readUTF(); this.elementSetId = in.readUTF(); this.scenarioId = in.readUTF(); this.needsUpload = in.readBoolean(); this.dataLength = in.readInt(); this.dataBytes = new byte[this.dataLength]; in.readFully(this.dataBytes); }
@Override public void readFields(DataInput in) throws IOException { String libDeps = in.readUTF(); Plugins.loadAllLibraries(libDeps); String className = in.readUTF(); _is = pp.InputSplit.create(className); int length = in.readInt(); byte[] data = new byte[length]; // System.out.printf("Java read data length: %d\n", length); in.readFully(data); _is.readFields(data); }
public IndexScanCommand deserialize(DataInput in, int version) throws IOException { String keyspace = in.readUTF(); String columnFamily = in.readUTF(); TDeserializer dser = new TDeserializer(new TBinaryProtocol.Factory()); IndexClause indexClause = new IndexClause(); FBUtilities.deserialize(dser, indexClause, in); SlicePredicate predicate = new SlicePredicate(); FBUtilities.deserialize(dser, predicate, in); AbstractBounds<RowPosition> range = AbstractBounds.serializer().deserialize(in, version).toRowBounds(); return new IndexScanCommand(keyspace, columnFamily, indexClause, predicate, range); }
public void readFields(DataInput in) throws IOException { contentType = in.readUTF(); UUID = in.readUTF(); dateString = in.readUTF(); recordType = in.readUTF(); metadata.clear(); int numMetaItems = in.readInt(); for (int i = 0; i < numMetaItems; i++) { String thisKey = in.readUTF(); String thisValue = in.readUTF(); metadata.put(thisKey, thisValue); } contentLength = in.readInt(); }
@Override public void readFrom(DataInput in) throws IOException { commandName = in.readUTF(); commandIdentifier = in.readUTF(); expectReply = in.readBoolean(); payloadType = in.readUTF(); payloadRevision = in.readUTF(); if ("_null".equals(payloadRevision)) { payloadRevision = null; } serializedPayload = new byte[in.readInt()]; in.readFully(serializedPayload); serializedMetaData = new byte[in.readInt()]; in.readFully(serializedMetaData); }
public TreeRequest deserialize(DataInput dis, int version) throws IOException { String sessId = dis.readUTF(); InetAddress endpoint = CompactEndpointSerializationHelper.deserialize(dis); CFPair cfpair = new CFPair(dis.readUTF(), dis.readUTF()); Range<Token> range; if (version > MessagingService.VERSION_07) range = (Range<Token>) AbstractBounds.serializer().deserialize(dis, version); else range = new Range<Token>( StorageService.getPartitioner().getMinimumToken(), StorageService.getPartitioner().getMinimumToken()); return new TreeRequest(sessId, endpoint, range, cfpair); }
public void readInternal(DataInput in) throws IOException { name = in.readUTF(); int targetBytesLength = in.readInt(); byte[] targetBytes = new byte[targetBytesLength]; in.readFully(targetBytes); this.target = (ActorRef) Util.toObject(targetBytes); }
/* * (non-Javadoc) * @see eu.stratosphere.core.io.IOReadableWritable#read(java.io.DataInput) */ @Override public void read(final DataInput in) throws IOException { this.mode = ExecutionMode.values()[in.readInt()]; final ArrayList<String> requiredPackages = new ArrayList<String>(); for (int count = in.readInt(); count > 0; count--) requiredPackages.add(in.readUTF()); this.query = null; final byte[] planBuffer = new byte[in.readInt()]; in.readFully(planBuffer); final JobID dummId = new JobID(); try { LibraryCacheManager.register( dummId, requiredPackages.toArray(new String[requiredPackages.size()])); SopremoEnvironment.getInstance().setClassLoader(LibraryCacheManager.getClassLoader(dummId)); this.query = SopremoUtil.deserialize(planBuffer, SopremoPlan.class); } catch (final IOException e) { e.printStackTrace(); } finally { try { LibraryCacheManager.unregister(dummId); } catch (final IOException e) { } } }
/** Serializes this object. */ public void readFields(DataInput in) throws IOException { int length = WritableUtils.readVInt(in); byte[] bytes = new byte[length]; in.readFully(bytes, 0, length); WikipediaPage.readPage(this, new String(bytes, "UTF-8")); language = in.readUTF(); }
/** Return {@code true} if a double slot is read (in case of Double or Long constant). */ private boolean readConstantPoolEntry(final DataInput di, final int index) throws IOException { final int tag = di.readUnsignedByte(); switch (tag) { case CP_METHOD_TYPE: di.skipBytes(2); // readUnsignedShort() return false; case CP_METHOD_HANDLE: di.skipBytes(3); return false; case CP_INTEGER: case CP_FLOAT: case CP_REF_FIELD: case CP_REF_METHOD: case CP_REF_INTERFACE: case CP_NAME_AND_TYPE: case CP_INVOKE_DYNAMIC: di.skipBytes(4); // readInt() / readFloat() / readUnsignedShort() * 2 return false; case CP_LONG: case CP_DOUBLE: di.skipBytes(8); // readLong() / readDouble() return true; case CP_UTF8: constantPool[index] = di.readUTF(); return false; case CP_CLASS: case CP_STRING: // reference to CP_UTF8 entry. The referenced index can have a higher number! constantPool[index] = di.readUnsignedShort(); return false; default: throw new ClassFormatError("Unkown tag value for constant pool entry: " + tag); } }
@SuppressWarnings("unchecked") public void readFields(DataInput is) throws IOException { disableCounter = is.readBoolean(); isMultiInputs = is.readBoolean(); totalSplits = is.readInt(); splitIndex = is.readInt(); inputIndex = is.readInt(); targetOps = (ArrayList<OperatorKey>) readObject(is); int splitLen = is.readInt(); String splitClassName = is.readUTF(); try { Class splitClass = conf.getClassByName(splitClassName); SerializationFactory sf = new SerializationFactory(conf); // The correct call sequence for Deserializer is, we shall open, then deserialize, but we // shall not close Deserializer d = sf.getDeserializer(splitClass); d.open((InputStream) is); wrappedSplits = new InputSplit[splitLen]; for (int i = 0; i < splitLen; i++) { wrappedSplits[i] = (InputSplit) ReflectionUtils.newInstance(splitClass, conf); d.deserialize(wrappedSplits[i]); } } catch (ClassNotFoundException e) { throw new IOException(e); } }
@Override public void handleRequest( final DataInput input, final ActiveOperation.ResultHandler<Void> resultHandler, final ManagementRequestContext<Void> context) throws IOException { byte param = input.readByte(); // If it failed if (param != DomainControllerProtocol.PARAM_OK) { final byte errorCode = input.readByte(); final String message = input.readUTF(); resultHandler.failed( new SlaveRegistrationException( SlaveRegistrationException.ErrorCode.parseCode(errorCode), message)); return; } final ModelNode extensions = new ModelNode(); extensions.readExternal(input); context.executeAsync( new ManagementRequestContext.AsyncTask<Void>() { @Override public void execute(ManagementRequestContext<Void> voidManagementRequestContext) throws Exception { // final ModelNode subsystems = resolveSubsystemVersions(extensions); channelHandler.executeRequest( context.getOperationId(), new RegisterSubsystemsRequest(subsystems)); } }); }
@Override public void readFields(DataInput in) throws IOException { // read head (rows, cols) _numRows = in.readInt(); int numCols = in.readInt(); // read columns (value type, data) _schema.clear(); _coldata.clear(); for (int j = 0; j < numCols; j++) { ValueType vt = ValueType.values()[in.readByte()]; String name = in.readUTF(); Array arr = null; switch (vt) { case STRING: arr = new StringArray(new String[_numRows]); break; case BOOLEAN: arr = new BooleanArray(new boolean[_numRows]); break; case INT: arr = new LongArray(new long[_numRows]); break; case DOUBLE: arr = new DoubleArray(new double[_numRows]); break; default: throw new IOException("Unsupported value type: " + vt); } arr.readFields(in); _schema.add(vt); _colnames.add(name); _coldata.add(arr); } }
@Override protected void readRequest(final DataInput input) throws IOException { int batchId = getHeader().getBatchId(); ProtocolUtils.expectHeader(input, ModelControllerProtocol.PARAM_MESSAGE_SEVERITY); MessageSeverity severity = Enum.valueOf(MessageSeverity.class, input.readUTF()); ProtocolUtils.expectHeader(input, ModelControllerProtocol.PARAM_MESSAGE); String message = input.readUTF(); ExecuteRequestContext requestContext = activeRequests.get(batchId); if (requestContext == null) { throw new IOException("No active request found for " + batchId); } if (requestContext.getMessageHandler() != null) { requestContext.getMessageHandler().handleReport(severity, message); } }
public static PCRecord deserialize(DataInput in, Map<Integer, String> fromIntMap) { PCRecord ret = new PCRecord(); try { for (PCRecord.StrField fld : PCRecord.StrField.values()) { int id = in.readInt(); ret.setField(fld, fromIntMap.get(id)); } ret.setLatitude(new BigDecimal(in.readUTF())); ret.setLongitude(new BigDecimal(in.readUTF())); ret.setAccuracy(in.readShort()); } catch (Throwable e) { throw new RuntimeException(e); } return ret; }
protected String looseUnmarshalString(DataInput dataIn) throws IOException { if (dataIn.readBoolean()) { return dataIn.readUTF(); } else { 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 void readFields(DataInput in) throws IOException { if (in.readBoolean()) { this.semiClusterId = in.readUTF(); } this.semiClusterScore = in.readDouble(); if (in.readBoolean()) { int len = in.readInt(); if (len > 0) { for (int i = 0; i < len; i++) { SemiClusteringVertex v = new SemiClusteringVertex(); v.readFields(in); semiClusterVertexList.add(v); } } } int len = in.readInt(); if (len > 0) { for (int i = 0; i < len; i++) { SemiClusterDetails sd = new SemiClusterDetails(); sd.readFields(in); semiClusterContainThis.add(sd); } } }
public RangeSliceCommand deserialize(DataInput dis, int version) throws IOException { String keyspace = dis.readUTF(); String columnFamily = dis.readUTF(); int scLength = dis.readInt(); ByteBuffer superColumn = null; if (scLength > 0) { byte[] buf = new byte[scLength]; dis.readFully(buf); superColumn = ByteBuffer.wrap(buf); } TDeserializer dser = new TDeserializer(new TBinaryProtocol.Factory()); SlicePredicate pred = new SlicePredicate(); FBUtilities.deserialize(dser, pred, dis); List<IndexExpression> rowFilter = null; if (version >= MessagingService.VERSION_11) { int filterCount = dis.readInt(); rowFilter = new ArrayList<IndexExpression>(filterCount); for (int i = 0; i < filterCount; i++) { IndexExpression expr = new IndexExpression(); FBUtilities.deserialize(dser, expr, dis); rowFilter.add(expr); } } AbstractBounds<RowPosition> range = AbstractBounds.serializer().deserialize(dis, version).toRowBounds(); int maxResults = dis.readInt(); boolean maxIsColumns = false; boolean isPaging = false; if (version >= MessagingService.VERSION_11) { maxIsColumns = dis.readBoolean(); isPaging = dis.readBoolean(); } return new RangeSliceCommand( keyspace, columnFamily, superColumn, pred, range, rowFilter, maxResults, maxIsColumns, isPaging); }
public Set<String> read(DataInput s) throws IOException { int count = s.readInt(); Set<String> result = new THashSet<String>(count); while (count-- > 0) { result.add(s.readUTF()); } return result; }
public static String readLongString(DataInput in) throws IOException { int count = in.readInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < count; i++) { sb.append(in.readUTF()); } return sb.toString(); }
@Override public String readUTF() { try { return input.readUTF(); } catch (IOException e) { throw new IllegalStateException(e); } }