com.twitter.elephantbird.cascading2.io.protobuf
Class ProtobufComparator

java.lang.Object
  extended by com.twitter.elephantbird.cascading2.io.protobuf.ProtobufComparator
All Implemented Interfaces:
cascading.tuple.StreamComparator<cascading.tuple.hadoop.io.BufferedInputStream>, Comparator<com.google.protobuf.Message>

public class ProtobufComparator
extends Object
implements cascading.tuple.StreamComparator<cascading.tuple.hadoop.io.BufferedInputStream>, Comparator<com.google.protobuf.Message>

Comparator for protobufs

Author:
Ning Liang

Constructor Summary
ProtobufComparator()
           
 
Method Summary
 int compare(cascading.tuple.hadoop.io.BufferedInputStream leftStream, cascading.tuple.hadoop.io.BufferedInputStream rightStream)
           
 int compare(com.google.protobuf.Message left, com.google.protobuf.Message right)
           
static void readFully(InputStream in, ByteArrayOutputStream out, byte[] buffer)
          Method used to read a protobuf input stream into a byte array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

ProtobufComparator

public ProtobufComparator()
Method Detail

compare

public int compare(cascading.tuple.hadoop.io.BufferedInputStream leftStream,
                   cascading.tuple.hadoop.io.BufferedInputStream rightStream)
Specified by:
compare in interface cascading.tuple.StreamComparator<cascading.tuple.hadoop.io.BufferedInputStream>

compare

public int compare(com.google.protobuf.Message left,
                   com.google.protobuf.Message right)
Specified by:
compare in interface Comparator<com.google.protobuf.Message>

readFully

public static void readFully(InputStream in,
                             ByteArrayOutputStream out,
                             byte[] buffer)
Method used to read a protobuf input stream into a byte array

Parameters:
in - the protobuf input stream
out - the byte output stream
buffer - the array out output bytes


Copyright © 2015 Twitter. All Rights Reserved.