List of usage examples for java.io DataOutput writeLong
void writeLong(long v) throws IOException;
long
value, which is comprised of eight bytes, to the output stream. From source file:com.chinamobile.bcbsp.util.StaffStatus.java
/** serialize * write this object to out.//from ww w . j a va 2 s .com * * @param out Writes to the output stream. */ @Override public void write(DataOutput out) throws IOException { jobId.write(out); staffId.write(out); out.writeInt(progress); WritableUtils.writeEnum(out, runState); Text.writeString(out, stateString); WritableUtils.writeEnum(out, phase); out.writeLong(startTime); out.writeLong(finishTime); out.writeLong(superstepCount); if (this.faultFlag == 0) { out.writeInt(this.faultFlag); } else { out.writeInt(this.faultFlag); this.fault.write(out); } out.writeBoolean(recovery); out.writeLong(this.currentSSTime); Text.writeString(out, workerManager); }
From source file:org.cloudata.core.tablet.ColumnValue.java
public void write(DataOutput out) throws IOException { rowKey.write(out);//from w w w . ja v a2 s . c o m 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:com.mobicage.rogerthat.registration.ContentBrandingRegistrationWizard.java
@Override public void writePickle(DataOutput out) throws IOException { T.UI();// w ww. ja v a 2 s . c o m boolean set = mCredentials != null; out.writeBoolean(set); if (set) { out.writeInt(mCredentials.getPickleClassVersion()); mCredentials.writePickle(out); } set = mEmail != null; out.writeBoolean(set); if (set) out.writeUTF(mEmail); out.writeLong(mTimestamp); out.writeUTF(mRegistrationId); out.writeUTF(mInstallationId); out.writeUTF(mDeviceId); }
From source file:com.chinamobile.bcbsp.sync.SuperStepReportContainer.java
@Override public void write(DataOutput out) throws IOException { out.writeInt(this.partitionId); out.writeInt(this.stageFlag); out.writeInt(this.dirFlag.length); int count = this.dirFlag.length; for (int i = 0; i < count; i++) { Text.writeString(out, this.dirFlag[i]); }// ww w.j ava2s . co m out.writeLong(this.judgeFlag); out.writeInt(this.localBarrierNum); out.writeInt(this.port1); out.writeInt(this.port2); out.writeInt(this.aggValues.length); count = this.aggValues.length; for (int i = 0; i < count; i++) { Text.writeString(out, this.aggValues[i]); } out.writeLong(this.staffRunTime); out.writeInt(this.sid); out.writeInt(this.currentSuperStep); out.writeLong(this.migrateCost); out.writeFloat(this.splitEdgefactor); }
From source file:org.apache.nutch.crawl.CrawlDatum.java
public void write(DataOutput out) throws IOException { out.writeByte(CUR_VERSION); // store current version out.writeByte(status);// w w w .ja v a 2 s . c o m out.writeLong(fetchTime); out.writeByte(retries); out.writeInt(fetchInterval); out.writeFloat(score); out.writeLong(modifiedTime); if (signature == null) { out.writeByte(0); } else { out.writeByte(signature.length); out.write(signature); } if (metaData != null && metaData.size() > 0) { out.writeBoolean(true); metaData.write(out); } else { out.writeBoolean(false); } }
From source file:org.apache.cassandra.db.compaction.LazilyCompactedRow.java
public void write(DataOutput out) throws IOException { DataOutputBuffer clockOut = new DataOutputBuffer(); ColumnFamily.serializer().serializeCFInfo(emptyColumnFamily, clockOut); long dataSize = headerBuffer.getLength() + clockOut.getLength() + columnSerializedSize; if (logger.isDebugEnabled()) logger.debug(String.format("header / clock / column sizes are %s / %s / %s", headerBuffer.getLength(), clockOut.getLength(), columnSerializedSize)); assert dataSize > 0; out.writeLong(dataSize); out.write(headerBuffer.getData(), 0, headerBuffer.getLength()); out.write(clockOut.getData(), 0, clockOut.getLength()); out.writeInt(columnCount);// w w w .ja va2 s . c o m Iterator<IColumn> iter = iterator(); while (iter.hasNext()) { IColumn column = iter.next(); emptyColumnFamily.getColumnSerializer().serialize(column, out); } long secondPassColumnSize = reducer == null ? 0 : reducer.serializedSize; assert secondPassColumnSize == columnSerializedSize : "originally calculated column size of " + columnSerializedSize + " but now it is " + secondPassColumnSize; }
From source file:org.apache.hadoop.mapred.SequenceFileRecordReader.java
/** * @param out contains file name, current offset, and supposed length *///from ww w .jav a2 s .c o m @Override public synchronized StopStatus tellAndStop(DataOutput out) throws IOException { if (!more || stopped || pos >= end) { if (LOG.isInfoEnabled()) { LOG.info("tellAndStop(): already stopped pos=" + pos + "; end=" + end); } return StopStatus.CANNOT_STOP; } Text.writeString(out, split.getPath().toString()); out.writeLong(in.getPosition()); out.writeLong(split.getStart() + split.getLength()); if (LOG.isDebugEnabled()) { LOG.debug("tellAndStop(): stop reading input stream at position " + in.getPosition()); } stopped = true; return StopStatus.STOPPED; }
From source file:org.apache.pig.data.DataBag.java
/** * Write a bag's contents to disk./*from w w w. j a va 2 s. c o m*/ * @param out DataOutput to write data to. * @throws IOException (passes it on from underlying calls). */ @Override public void write(DataOutput out) throws IOException { // We don't care whether this bag was sorted or distinct because // using the iterator to write it will guarantee those things come // correctly. And on the other end there'll be no reason to waste // time re-sorting or re-applying distinct. out.write(BAG); out.writeLong(size()); for (Tuple t : this) { t.write(out); } }
From source file:parquet.hadoop.ParquetInputSplit.java
private void writeColumn(DataOutput out, ColumnChunkMetaData column) throws IOException { out.writeInt(column.getCodec().ordinal()); out.writeInt(column.getPath().size()); for (String s : column.getPath()) { out.writeUTF(s);/* www . j a va2 s . com*/ } out.writeInt(column.getType().ordinal()); out.writeInt(column.getEncodings().size()); for (Encoding encoding : column.getEncodings()) { out.writeInt(encoding.ordinal()); } out.writeLong(column.getFirstDataPageOffset()); out.writeLong(column.getDictionaryPageOffset()); out.writeLong(column.getValueCount()); out.writeLong(column.getTotalSize()); out.writeLong(column.getTotalUncompressedSize()); }
From source file:com.marklogic.tree.ExpandedTree.java
@Override public void write(DataOutput out) throws IOException { out.writeLong(uriKey); out.writeLong(uniqKey);// w w w . j a va 2 s. c o m out.writeLong(linkKey); out.writeInt(numKeys); if (numKeys > 0) { for (long key : keys) { out.writeLong(key); } } if (atomData != null && atomData.length > 0) { out.writeInt(atomData.length); for (int i = 0; i < atomData.length; i++) { out.writeByte(atomData[i]); } } else { out.writeInt(0); } out.writeInt(atomLimit); if (atomIndex != null && atomIndex.length > 0) { for (int i = 0; i < atomIndex.length; i++) { out.writeInt(atomIndex[i]); } } if (nodeNameNameAtom != null && nodeNameNameAtom.length > 0) { out.writeInt(nodeNameNameAtom.length); for (int i = 0; i < nodeNameNameAtom.length; i++) { out.writeInt(nodeNameNameAtom[i]); out.writeInt(nodeNameNamespaceAtom[i]); } } else { out.writeInt(0); } out.writeInt(numNodeReps); if (numNodeReps > 0) { for (int i = 0; i < numNodeReps; i++) { out.writeLong(nodeOrdinal[i]); out.writeByte(nodeKind[i]); out.writeInt(nodeRepID[i]); out.writeInt(nodeParentNodeRepID[i]); } } if (elemNodeNodeNameRepID != null && elemNodeNodeNameRepID.length > 0) { out.writeInt(elemNodeNodeNameRepID.length); for (int i = 0; i < elemNodeNodeNameRepID.length; i++) { out.writeInt(elemNodeNodeNameRepID[i]); out.writeInt(elemNodeAttrNodeRepID[i]); out.writeInt(elemNodeChildNodeRepID[i]); out.writeInt(elemNodeElemDeclRepID[i]); out.writeInt(elemNodeNumAttributes[i]); out.writeInt(elemNodeNumDefaultAttrs[i]); out.writeInt(elemNodeNumChildren[i]); out.writeInt(elemNodeFlags[i]); } } else { out.writeInt(0); } if (attrNodeNodeNameRepID != null && attrNodeNodeNameRepID.length > 0) { out.writeInt(attrNodeNodeNameRepID.length); for (int i = 0; i < attrNodeNodeNameRepID.length; i++) { out.writeInt(attrNodeNodeNameRepID[i]); out.writeInt(attrNodeTextRepID[i]); out.writeInt(attrNodeAttrDeclRepID[i]); } } else { out.writeInt(0); } out.writeInt(numLinkNodeReps); if (numLinkNodeReps > 0) { for (int i = 0; i < numLinkNodeReps; i++) { out.writeLong(linkNodeKey[i]); out.writeLong(linkNodeNodeCount[i]); out.writeInt(linkNodeNodeNameRepID[i]); out.writeInt(linkNodeNodeRepID[i]); } } if (docNodeTextRepID != null && docNodeTextRepID.length > 0) { out.writeInt(docNodeTextRepID.length); for (int i = 0; i < docNodeTextRepID.length; i++) { out.writeInt(docNodeTextRepID[i]); out.writeInt(docNodeChildNodeRepID[i]); out.writeInt(docNodeNumChildren[i]); } } else { out.writeInt(0); } if (piNodeTargetAtom != null && piNodeTargetAtom.length > 0) { out.writeInt(piNodeTargetAtom.length); for (int i = 0; i < piNodeTargetAtom.length; i++) { out.writeInt(piNodeTargetAtom[i]); out.writeInt(piNodeTextRepID[i]); } } else { out.writeInt(0); } out.writeInt(numNSNodeReps); if (numNSNodeReps > 0) { for (int i = 0; i < numNSNodeReps; i++) { out.writeLong(nsNodeOrdinal[i]); out.writeInt(nsNodePrevNSNodeRepID[i]); out.writeInt(nsNodePrefixAtom[i]); out.writeInt(nsNodeUriAtom[i]); } } // skip permission node since it's not exposed to the API out.writeInt(uriTextRepID); out.writeInt(colsTextRepID); out.writeInt(numTextReps); if (numTextReps > 0) { for (int i = 0; i < numTextReps; i++) { out.writeInt(textReps[i]); } } if (arrayNodeTextRepID != null && arrayNodeTextRepID.length > 0) { out.writeInt(arrayNodeTextRepID.length); for (int i = 0; i < arrayNodeTextRepID.length; i++) { out.writeInt(arrayNodeTextRepID[i]); out.writeInt(arrayNodeChildNodeRepID[i]); out.writeInt(arrayNodeNumChildren[i]); } } else { out.writeInt(0); } if (doubles != null && doubles.length > 0) { out.writeInt(doubles.length); for (int i = 0; i < doubles.length; i++) { out.writeDouble(doubles[i]); } } else { out.writeInt(0); } }