summaryrefslogtreecommitdiff
path: root/lib/java/src/main/java/org/apache/thrift/transport/TByteBuffer.java
diff options
context:
space:
mode:
Diffstat (limited to 'lib/java/src/main/java/org/apache/thrift/transport/TByteBuffer.java')
-rw-r--r--lib/java/src/main/java/org/apache/thrift/transport/TByteBuffer.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/java/src/main/java/org/apache/thrift/transport/TByteBuffer.java b/lib/java/src/main/java/org/apache/thrift/transport/TByteBuffer.java
index fa296e7c4..226f02a04 100644
--- a/lib/java/src/main/java/org/apache/thrift/transport/TByteBuffer.java
+++ b/lib/java/src/main/java/org/apache/thrift/transport/TByteBuffer.java
@@ -10,17 +10,29 @@ public final class TByteBuffer extends TEndpointTransport {
private final ByteBuffer byteBuffer;
/**
- * Creates a new TByteBuffer wrapping a given NIO ByteBuffer.
+ * Creates a new TByteBuffer wrapping a given NIO ByteBuffer and custom TConfiguration.
*
+ * @param configuration the custom TConfiguration.
* @param byteBuffer the NIO ByteBuffer to wrap.
* @throws TTransportException on error.
*/
- public TByteBuffer(ByteBuffer byteBuffer) throws TTransportException {
- super(new TConfiguration());
+ public TByteBuffer(TConfiguration configuration, ByteBuffer byteBuffer)
+ throws TTransportException {
+ super(configuration);
this.byteBuffer = byteBuffer;
updateKnownMessageSize(byteBuffer.capacity());
}
+ /**
+ * Creates a new TByteBuffer wrapping a given NIO ByteBuffer.
+ *
+ * @param byteBuffer the NIO ByteBuffer to wrap.
+ * @throws TTransportException on error.
+ */
+ public TByteBuffer(ByteBuffer byteBuffer) throws TTransportException {
+ this(new TConfiguration(), byteBuffer);
+ }
+
@Override
public boolean isOpen() {
return true;