List of usage examples for java.io DataOutput writeInt
void writeInt(int v) throws IOException;
int
value, which is comprised of four bytes, to the output stream. From source file:org.cloudata.core.tablet.ColumnValue.java
public void write(DataOutput out) throws IOException { rowKey.write(out);/* w w w . jav a 2s. c om*/ cellKey.write(out); //write operation if (deleted) { out.writeInt(Constants.DELETEED); } else { out.writeInt(Constants.INSERTED); } //write timestame out.writeLong(timestamp); //write numOfValues out.writeInt(numOfValues); //write value int valueLength = (value == null ? -1 : value.length); out.writeInt(valueLength); if (valueLength > 0) { out.write(value); } }
From source file:org.apache.hadoop.mapred.ClusterStatus.java
public void write(DataOutput out) throws IOException { if (activeTrackers.size() == 0) { out.writeInt(numActiveTrackers); out.writeInt(0);/* w w w . j ava 2s. c o m*/ } else { out.writeInt(activeTrackers.size()); out.writeInt(activeTrackers.size()); for (String tracker : activeTrackers) { Text.writeString(out, tracker); } } if (blacklistedTrackers.size() == 0) { out.writeInt(numBlacklistedTrackers); out.writeInt(0); } else { out.writeInt(blacklistedTrackers.size()); out.writeInt(blacklistedTrackers.size()); for (String tracker : blacklistedTrackers) { Text.writeString(out, tracker); } } if (graylistedTrackers.size() == 0) { out.writeInt(numGraylistedTrackers); out.writeInt(0); } else { out.writeInt(graylistedTrackers.size()); out.writeInt(graylistedTrackers.size()); for (String tracker : graylistedTrackers) { Text.writeString(out, tracker); } } out.writeInt(numExcludedNodes); out.writeLong(ttExpiryInterval); out.writeInt(map_tasks); out.writeInt(reduce_tasks); out.writeInt(max_map_tasks); out.writeInt(max_reduce_tasks); out.writeLong(used_memory); out.writeLong(max_memory); WritableUtils.writeEnum(out, state); }
From source file:org.apache.rya.reasoning.mr.SchemaWritable.java
@Override public void write(DataOutput out) throws IOException { ArrayList<OwlProperty> propList = new ArrayList<>(properties.values()); ArrayList<OwlClass> classList = new ArrayList<>(classes.values()); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); ObjectOutputStream stream = new ObjectOutputStream(bytes); stream.writeObject(propList);/*from w w w.j a va 2 s . c om*/ stream.writeObject(classList); byte[] arr = bytes.toByteArray(); stream.close(); out.writeInt(arr.length); out.write(arr); }
From source file:io.hops.erasure_coding.PolicyInfo.java
public void write(DataOutput out) throws IOException { if (srcPath == null) { Text.writeString(out, ""); } else {// ww w . ja va 2s . co m Text.writeString(out, srcPath.toString()); } Text.writeString(out, policyName); Text.writeString(out, codecId); Text.writeString(out, description); out.writeInt(properties.size()); for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();) { String name = (String) e.nextElement(); Text.writeString(out, name); Text.writeString(out, properties.getProperty(name)); } }
From source file:org.cloudata.core.tablet.TableSchema.java
public void write(DataOutput out) throws IOException { out.writeInt(SCHEMA_VERSION); CWritableUtils.writeString(out, tableName); CWritableUtils.writeString(out, description); out.writeInt(numOfVersion);/*from www .java 2 s . com*/ CWritableUtils.writeString(out, owner); int size = columns.size(); out.writeInt(size); for (ColumnInfo column : columns) { column.write(out); } out.writeInt(permissions.size()); for (Map.Entry<String, String> entry : permissions.entrySet()) { CWritableUtils.writeString(out, entry.getKey()); CWritableUtils.writeString(out, entry.getValue()); } }
From source file:org.apache.nutch.crawl.MapWritable.java
public void write(DataOutput out) throws IOException { out.writeInt(size()); if (size() > 0) { // scan for unknown classes; createInternalIdClassEntries();/*from w w w . ja v a2s . c o m*/ // write internal map out.writeByte(fIdCount); if (fIdCount > 0) { ClassIdEntry entry = fIdFirst; while (entry != null) { out.writeByte(entry.fId); Text.writeString(out, entry.fclazz.getName()); entry = entry.fNextIdEntry; } } // write meta data KeyValueEntry entry = fFirst; while (entry != null) { out.writeByte(entry.fKeyClassId); out.writeByte(entry.fValueClassId); entry.fKey.write(out); entry.fValue.write(out); entry = entry.fNextEntry; } } }
From source file:org.cloudata.core.client.Row.java
@Override public void write(DataOutput out) throws IOException { key.write(out);//from w w w . j a va 2 s. c om out.writeInt(cells.size()); for (Map.Entry<String, TreeMap<Cell.Key, Cell>> entry : cells.entrySet()) { String columnName = entry.getKey(); CWritableUtils.writeString(out, columnName); TreeMap<Cell.Key, Cell> columnCells = entry.getValue(); int columnCellsSize = columnCells == null ? 0 : columnCells.size(); out.writeInt(columnCellsSize); if (columnCellsSize > 0) { for (Cell eachCell : columnCells.values()) { //System.out.println(columnName + ">" + eachCell.getKey() + ">" + eachCell.getValueAsString()); eachCell.write(out); } } } }
From source file:org.apache.geode.distributed.internal.StartupMessage.java
@Override public void toData(DataOutput out) throws IOException { super.toData(out); DataSerializer.writeString(this.version, out); out.writeInt(this.replyProcessorId); out.writeBoolean(this.isMcastEnabled); out.writeBoolean(this.isTcpDisabled); // Send a description of all of the DataSerializers and // Instantiators that have been registered SerializerAttributesHolder[] sahs = InternalDataSerializer.getSerializersForDistribution(); out.writeInt(sahs.length);// w ww . j a va 2s. c o m for (int i = 0; i < sahs.length; i++) { DataSerializer.writeNonPrimitiveClassName(sahs[i].getClassName(), out); out.writeInt(sahs[i].getId()); } Object[] insts = InternalInstantiator.getInstantiatorsForSerialization(); out.writeInt(insts.length); for (int i = 0; i < insts.length; i++) { String instantiatorClassName, instantiatedClassName; int id; if (insts[i] instanceof Instantiator) { instantiatorClassName = ((Instantiator) insts[i]).getClass().getName(); instantiatedClassName = ((Instantiator) insts[i]).getInstantiatedClass().getName(); id = ((Instantiator) insts[i]).getId(); } else { instantiatorClassName = ((InstantiatorAttributesHolder) insts[i]).getInstantiatorClassName(); instantiatedClassName = ((InstantiatorAttributesHolder) insts[i]).getInstantiatedClassName(); id = ((InstantiatorAttributesHolder) insts[i]).getId(); } DataSerializer.writeNonPrimitiveClassName(instantiatorClassName, out); DataSerializer.writeNonPrimitiveClassName(instantiatedClassName, out); out.writeInt(id); } DataSerializer.writeObject(interfaces, out); out.writeInt(distributedSystemId); DataSerializer.writeString(redundancyZone, out); out.writeBoolean(enforceUniqueZone); StartupMessageData data = new StartupMessageData(); data.writeHostedLocators(this.hostedLocatorsAll); data.writeIsSharedConfigurationEnabled(this.isSharedConfigurationEnabled); data.writeMcastPort(this.mcastPort); data.writeMcastHostAddress(this.mcastHostAddress); data.writeTo(out); }
From source file:eu.stratosphere.nephele.configuration.Configuration.java
/** * {@inheritDoc}/* ww w .j a v a 2 s. c o m*/ */ @Override public void write(final DataOutput out) throws IOException { synchronized (this.confData) { out.writeInt(this.confData.size()); final Iterator<String> it = this.confData.keySet().iterator(); while (it.hasNext()) { final String key = it.next(); final String value = this.confData.get(key); StringRecord.writeString(out, key); StringRecord.writeString(out, value); } } }
From source file:org.apache.hadoop.hbase.HServerInfo.java
public void write(DataOutput out) throws IOException { this.serverAddress.write(out); out.writeLong(this.startCode); this.load.write(out); // Still serializing the info port for backward compatibility but it is not used. out.writeInt(HConstants.DEFAULT_REGIONSERVER_INFOPORT); out.writeUTF(hostname);/*from www. j av a 2s . c o m*/ if (sendSequenceIds) { HbaseMapWritable<byte[], Long> sequenceIdsWritable = new HbaseMapWritable<byte[], Long>( flushedSequenceIdByRegion); sequenceIdsWritable.write(out); } }