List of usage examples for org.apache.hadoop.io WritableUtils writeEnum
public static void writeEnum(DataOutput out, Enum<?> enumVal) throws IOException
From source file:com.netflix.aegisthus.input.AegSplit.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { out.writeLong(end);/* w w w .j a v a 2 s . c o m*/ WritableUtils.writeStringArray(out, hosts); WritableUtils.writeString(out, path.toUri().toString()); out.writeBoolean(compressed); if (compressed) { WritableUtils.writeString(out, compressedPath.toUri().toString()); } out.writeLong(start); WritableUtils.writeEnum(out, type); if (convertors != null) { String[] parts = new String[2]; out.writeInt(convertors.size()); for (Map.Entry<String, AbstractType> e : convertors.entrySet()) { parts[0] = e.getKey(); parts[1] = e.getValue().toString(); WritableUtils.writeStringArray(out, parts); } } else { out.writeInt(0); } }
From source file:in.dream_lab.goffish.ControlMessage.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { WritableUtils.writeEnum(out, transmissionType); out.writeInt(extraInfo.size());/*w ww . j a va 2 s . co m*/ for (BytesWritable info : extraInfo) { info.write(out); } if (isPartitionMessage()) { out.writeInt(partitionID); } else if (isVertexMessage()) { vertexValues.write(out); } }
From source file:in.dream_lab.goffish.hama.ControlMessage.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { WritableUtils.writeEnum(out, transmissionType); out.writeInt(extraInfo.size());//w w w . j ava2 s . c o m for (BytesWritable info : extraInfo) { info.write(out); } if (isPartitionMessage()) { out.writeInt(sourcePartitionID); } else if (isVertexMessage()) { vertexValues.write(out); } }
From source file:in.dream_lab.goffish.hama.Message.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { control.write(out);/*from ww w . j a va 2s . com*/ WritableUtils.writeEnum(out, messageType); out.writeBoolean(hasSubgraphID); if (hasSubgraphID) { subgraphID.write(out); } out.writeBoolean(hasMessage); if (hasMessage) { message.write(out); } }
From source file:org.apache.gora.filter.MapFieldValueFilter.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, fieldName); Text.writeString(out, mapKey.toString()); WritableUtils.writeEnum(out, filterOp); WritableUtils.writeVInt(out, operands.size()); for (int i = 0; i < operands.size(); i++) { Object operand = operands.get(i); if (operand instanceof String) { throw new IllegalStateException("Use Utf8 instead of String for operands"); }//w w w. j a v a 2s .c om if (operand instanceof Utf8) { operand = operand.toString(); } if (operand instanceof Boolean) { ObjectWritable.writeObject(out, operand, Boolean.TYPE, conf); } else if (operand instanceof Character) { ObjectWritable.writeObject(out, operand, Character.TYPE, conf); } else if (operand instanceof Byte) { ObjectWritable.writeObject(out, operand, Byte.TYPE, conf); } else if (operand instanceof Short) { ObjectWritable.writeObject(out, operand, Short.TYPE, conf); } else if (operand instanceof Integer) { ObjectWritable.writeObject(out, operand, Integer.TYPE, conf); } else if (operand instanceof Long) { ObjectWritable.writeObject(out, operand, Long.TYPE, conf); } else if (operand instanceof Float) { ObjectWritable.writeObject(out, operand, Float.TYPE, conf); } else if (operand instanceof Double) { ObjectWritable.writeObject(out, operand, Double.TYPE, conf); } else if (operand instanceof Void) { ObjectWritable.writeObject(out, operand, Void.TYPE, conf); } else { ObjectWritable.writeObject(out, operand, operand.getClass(), conf); } } out.writeBoolean(filterIfMissing); }
From source file:org.apache.gora.filter.SingleFieldValueFilter.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, fieldName); WritableUtils.writeEnum(out, filterOp); WritableUtils.writeVInt(out, operands.size()); for (int i = 0; i < operands.size(); i++) { Object operand = operands.get(i); if (operand instanceof String) { throw new IllegalStateException("Use Utf8 instead of String for operands"); }/* w w w .j a v a2s. c o m*/ if (operand instanceof Utf8) { operand = operand.toString(); } if (operand instanceof Boolean) { ObjectWritable.writeObject(out, operand, Boolean.TYPE, conf); } else if (operand instanceof Character) { ObjectWritable.writeObject(out, operand, Character.TYPE, conf); } else if (operand instanceof Byte) { ObjectWritable.writeObject(out, operand, Byte.TYPE, conf); } else if (operand instanceof Short) { ObjectWritable.writeObject(out, operand, Short.TYPE, conf); } else if (operand instanceof Integer) { ObjectWritable.writeObject(out, operand, Integer.TYPE, conf); } else if (operand instanceof Long) { ObjectWritable.writeObject(out, operand, Long.TYPE, conf); } else if (operand instanceof Float) { ObjectWritable.writeObject(out, operand, Float.TYPE, conf); } else if (operand instanceof Double) { ObjectWritable.writeObject(out, operand, Double.TYPE, conf); } else if (operand instanceof Void) { ObjectWritable.writeObject(out, operand, Void.TYPE, conf); } else { ObjectWritable.writeObject(out, operand, operand.getClass(), conf); } } out.writeBoolean(filterIfMissing); }
From source file:org.apache.hama.bsp.ClusterStatus.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { if (activeGrooms.isEmpty()) { out.writeInt(numActiveGrooms);//w ww.j av a 2 s.c o m out.writeBoolean(false); } else { out.writeInt(activeGrooms.size()); out.writeBoolean(true); for (Entry<String, GroomServerStatus> entry : activeGrooms.entrySet()) { out.writeUTF(entry.getKey()); entry.getValue().write(out); } } out.writeInt(tasks); out.writeInt(maxTasks); WritableUtils.writeEnum(out, state); }
From source file:org.apache.hama.bsp.DispatchTasksDirective.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { super.write(out); if (this.actions == null) { WritableUtils.writeVInt(out, 0); } else {/*from w ww . j a v a2 s. c om*/ WritableUtils.writeVInt(out, actions.length); for (GroomServerAction action : this.actions) { WritableUtils.writeEnum(out, action.getActionType()); action.write(out); } } }
From source file:org.apache.hama.bsp.GroomServerAction.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { WritableUtils.writeEnum(out, actionType); }
From source file:org.apache.hama.bsp.TaskCompletionEvent.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { taskId.write(out);/*from w ww . j av a 2s . co m*/ WritableUtils.writeVInt(out, idWithinJob); WritableUtils.writeEnum(out, status); WritableUtils.writeString(out, groomServerInfo); WritableUtils.writeVInt(out, taskRunTime); WritableUtils.writeVInt(out, eventId); }