Java Code Examples for com.google.protobuf.CodedOutputStream#writeMessageNoTag()

The following examples show how to use com.google.protobuf.CodedOutputStream#writeMessageNoTag() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DAGKillRequestEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 2
Source File: TaskAttemptStartedEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 3
Source File: VertexGroupCommitFinishedEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 4
Source File: VertexStartedEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 5
Source File: VertexInitializedEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 6
Source File: TaskStartedEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 7
Source File: DAGStartedEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 8
Source File: VertexConfigurationDoneEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 9
Source File: DAGInitializedEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 10
Source File: DAGSubmittedEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 11
Source File: ProtoBufSerialization.java    From eagle with Apache License 2.0 4 votes vote down vote up
@Override
public byte[] serialize(Object obj) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    CodedOutputStream output = CodedOutputStream.newInstance(baos);
    output.writeBoolNoTag(obj == null);
    if (obj == null) {
        output.flush();
        return baos.toByteArray();
    }

    Class<?> clazz = obj.getClass();
    if (clazz == int.class || clazz == Integer.class) {
        output.writeSInt32NoTag((Integer) obj);
    } else if (clazz == long.class || clazz == Long.class) {
        output.writeSInt64NoTag((Long) obj);
    } else if (clazz == boolean.class || clazz == Boolean.class) {
        output.writeBoolNoTag((Boolean) obj);
    } else if (clazz == byte.class || clazz == Byte.class) {
        output.writeRawByte((Byte) obj);
    } else if (clazz == char.class || clazz == Character.class) {
        output.writeSInt32NoTag((Character) obj);
    } else if (clazz == short.class || clazz == Short.class) {
        output.writeSInt32NoTag((Short) obj);
    } else if (clazz == double.class || clazz == Double.class) {
        output.writeDoubleNoTag((Double) obj);
    } else if (clazz == float.class || clazz == Float.class) {
        output.writeFloatNoTag((Float) obj);
    } else if (clazz == String.class) {
        output.writeStringNoTag(obj.toString());
    } else if (MessageLite.class.isAssignableFrom(clazz)) {
        output.writeMessageNoTag((MessageLite) obj);
    } else if (Throwable.class.isAssignableFrom(clazz)) {
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(obj);
        oos.flush();
    } else {
        throw new IllegalArgumentException("can't serialization " + clazz);
    }

    output.flush();
    return baos.toByteArray();
}
 
Example 12
Source File: TaskFinishedEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 13
Source File: DAGCommitStartedEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 14
Source File: AMStartedEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 15
Source File: VertexFinishedEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 16
Source File: AMLaunchedEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 17
Source File: VertexGroupCommitStartedEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 18
Source File: ContainerLaunchedEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 19
Source File: TaskAttemptFinishedEvent.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public void toProtoStream(CodedOutputStream outputStream) throws IOException {
  outputStream.writeMessageNoTag(toProto());
}
 
Example 20
Source File: MessageLiteCodec.java    From bazel with Apache License 2.0 4 votes vote down vote up
@Override
public void serialize(
    SerializationContext unusedContext, MessageLite message, CodedOutputStream codedOut)
    throws IOException, SerializationException {
  codedOut.writeMessageNoTag(message);
}