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.apache.hama.bsp.Directive.java
public void write(DataOutput out) throws IOException { out.writeLong(this.timestamp); out.writeInt(this.type.value()); if (getType().value() == Directive.Type.Request.value()) { if (this.actionList == null) { WritableUtils.writeVInt(out, 0); } else {// w w w . ja va 2 s . c om WritableUtils.writeVInt(out, actionList.size()); for (GroomServerAction action : this.actionList) { WritableUtils.writeEnum(out, action.getActionType()); action.write(out); } } String[] groomServerNames = groomServerPeers.keySet().toArray(new String[0]); WritableUtils.writeCompressedStringArray(out, groomServerNames); List<String> groomServerAddresses = new ArrayList<String>(groomServerNames.length); for (String groomName : groomServerNames) { groomServerAddresses.add(groomServerPeers.get(groomName)); } WritableUtils.writeCompressedStringArray(out, groomServerAddresses.toArray(new String[0])); } else if (getType().value() == Directive.Type.Response.value()) { this.status.write(out); } else { throw new IllegalStateException("Wrong directive type:" + getType()); } }
From source file:org.apache.hadoop.hdfs.server.namenode.FSImageSerialization.java
/** Serialize an {@link INodeFileAttributes}. */ public static void writeINodeFileAttributes(INodeFileAttributes file, DataOutput out) throws IOException { LOG.info("== Inside writeINodeFileAttributes() =="); LOG.info("Parameters count and cached"); LOG.info("ACCESSCNT " + file.getAccessCount()); LOG.info("CACHED " + file.getIsCached()); writeLocalName(file, out);/*from w w w .j ava 2 s .co m*/ writePermissionStatus(file, out); out.writeLong(file.getModificationTime()); out.writeLong(file.getAccessTime()); out.writeShort(file.getFileReplication()); out.writeLong(file.getPreferredBlockSize()); out.writeLong(file.getAccessCount()); out.writeInt(file.getIsCached()); }
From source file:edu.umn.cs.spatialHadoop.core.JTSShape.java
@Override public void write(DataOutput out) throws IOException { byte[] wkb = wkbWriter.write(geom); out.writeInt(wkb.length); out.write(wkb);// www. ja va 2 s . c o m }
From source file:org.apache.hama.bsp.Task.java
@Override public void write(DataOutput out) throws IOException { jobId.write(out);//from w ww. j a v a 2 s .co m Text.writeString(out, jobFile); taskId.write(out); out.writeInt(partition); }
From source file:org.godhuli.rhipe.RHBytesWritable.java
public void writeAsInt(final DataOutput out) throws IOException { out.writeInt(size); out.write(bytes, 0, size);/* w w w . ja v a2 s . co m*/ }
From source file:com.kylinolap.dict.DateStrDictionary.java
@Override public void write(DataOutput out) throws IOException { out.writeUTF(pattern); out.writeInt(baseId); }
From source file:org.apache.hadoop.mapred.JTAddress.java
public void write(DataOutput out) throws IOException { if (address == null) { out.writeUTF(""); out.writeInt(0); } else {// w ww . jav a 2 s . co m out.writeUTF(address.getAddress().getHostName()); out.writeInt(address.getPort()); } }
From source file:org.lilyproject.repository.impl.id.AbsoluteRecordIdImpl.java
@Override public byte[] toBytes() { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); DataOutput dataOutput = new DataOutputStream(byteArrayOutputStream); byte[] tableBytes = table.getBytes(); byte[] recordIdBytes = recordId.toBytes(); try {//from ww w. j a v a 2 s . c o m dataOutput.writeInt(tableBytes.length); dataOutput.write(tableBytes); dataOutput.writeInt(recordIdBytes.length); dataOutput.write(recordIdBytes); } catch (IOException ioe) { throw new RuntimeException("Error serializing AbsoluteRecordId: " + toString(), ioe); } return byteArrayOutputStream.toByteArray(); }
From source file:org.apache.nutch.protocol.Content.java
public final void write(DataOutput out) throws IOException { out.writeInt(VERSION); Text.writeString(out, url); // write url Text.writeString(out, base); // write base out.writeInt(content.length); // write content out.write(content);//from www . j a v a2 s. c o m Text.writeString(out, contentType); // write contentType metadata.write(out); // write metadata }
From source file:org.cloudata.core.tabletserver.CommitLog.java
public void write(DataOutput out) throws IOException { writeBytes = 0;//from w w w . j a v a2 s . c o m out.writeInt(operation); writeBytes += CWritableUtils.getIntByteSize(); rowKey.write(out); writeBytes += rowKey.getByteSize(); writeBytes += CWritableUtils.writeString(out, columnName); columnKey.write(out); writeBytes += columnKey.getByteSize(); out.writeLong(timestamp); writeBytes += CWritableUtils.getLongByteSize(); out.writeInt(value == null ? -1 : value.length); writeBytes += CWritableUtils.getIntByteSize(); if (value != null) { out.write(value); writeBytes += value.length; } }