Created
July 8, 2014 20:53
-
-
Save awhogue/72c0f6546c61960f8511 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Class that wraps a TSerializer. | |
*/ | |
class ThriftSerializerWithClassName[T <: BoundedTBase] { | |
val protocolFactory = new TCompactProtocol.Factory() | |
// TSerializer reuses a ByteArrayOutputStream, but isn't threadsafe. | |
val serializer = new TSerializer(protocolFactory) | |
def serialize(t: T): Array[Byte] = { | |
serializer.serialize(t) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment