summaryrefslogtreecommitdiff
path: root/lib/java/src/main/java/org/apache/thrift/TSerializer.java
diff options
context:
space:
mode:
Diffstat (limited to 'lib/java/src/main/java/org/apache/thrift/TSerializer.java')
-rw-r--r--lib/java/src/main/java/org/apache/thrift/TSerializer.java14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/java/src/main/java/org/apache/thrift/TSerializer.java b/lib/java/src/main/java/org/apache/thrift/TSerializer.java
index 6c0c7c2f8..8bcd49451 100644
--- a/lib/java/src/main/java/org/apache/thrift/TSerializer.java
+++ b/lib/java/src/main/java/org/apache/thrift/TSerializer.java
@@ -32,11 +32,8 @@ public class TSerializer {
/** This is the byte array that data is actually serialized into */
private final ByteArrayOutputStream baos_ = new ByteArrayOutputStream();
- /** This transport wraps that byte array */
- private final TIOStreamTransport transport_;
-
/** Internal protocol used for serializing objects. */
- private TProtocol protocol_;
+ private final TProtocol protocol_;
/**
* Create a new TSerializer that uses the TBinaryProtocol by default.
@@ -51,10 +48,11 @@ public class TSerializer {
* Create a new TSerializer. It will use the TProtocol specified by the factory that is passed in.
*
* @param protocolFactory Factory to create a protocol
- * @throws TTransportException if there an error initializing the underlying transport.
+ * @throws TTransportException if there is an error initializing the underlying transport.
*/
public TSerializer(TProtocolFactory protocolFactory) throws TTransportException {
- transport_ = new TIOStreamTransport(new TConfiguration(), baos_);
+ /* This transport wraps that byte array */
+ TIOStreamTransport transport_ = new TIOStreamTransport(new TConfiguration(), baos_);
protocol_ = protocolFactory.getProtocol(transport_);
}
@@ -66,7 +64,7 @@ public class TSerializer {
* @return Serialized object in byte[] format
* @throws TException if an error is encountered during serialization.
*/
- public byte[] serialize(TBase base) throws TException {
+ public byte[] serialize(TBase<?, ?> base) throws TException {
baos_.reset();
base.write(protocol_);
return baos_.toByteArray();
@@ -79,7 +77,7 @@ public class TSerializer {
* @return Serialized object as a String
* @throws TException if an error is encountered during serialization.
*/
- public String toString(TBase base) throws TException {
+ public String toString(TBase<?, ?> base) throws TException {
return new String(serialize(base));
}
}