# Class BinaryTCPClientImpl

java.lang.Object
org.apache.jmeter.protocol.tcp.sampler.AbstractTCPClient
org.apache.jmeter.protocol.tcp.sampler.BinaryTCPClientImpl

All Implemented Interfaces:
  `TCPClient`

public class BinaryTCPClientImpl extends AbstractTCPClient
TCPClient implementation. Reads data until the defined EOM byte is reached. If there is no EOM byte defined, then reads until the end of the stream is reached. The EOM byte is defined by the property "tcp.BinaryTCPClient.eomByte". Input data is assumed to be in hex, and is converted to binary

## Field Summary

### Fields inherited from class AbstractTCPClient

`eolByte, useEolByte`

## Constructor Summary

Constructors
Constructor
Description
`BinaryTCPClientImpl()`

## Method Summary

Modifier and Type
Method
Description
`static final byte[]`
`hexStringToByteArray(String hexEncodedBinary)`
Convert hex string to binary byte array.
`String`
`read(InputStream is)`
Reads data until the defined EOM byte is reached.
`void`
`write(OutputStream os, InputStream is)`
`void`
`write(OutputStream os, String hexEncodedBinary)`
Input (hex) string is converted to binary and written to the output stream.

### Methods inherited from class AbstractTCPClient

`getCharset, getEolByte, setCharset, setEolByte, setupTest, teardownTest`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### BinaryTCPClientImpl

public BinaryTCPClientImpl()

## Method Details

### hexStringToByteArray

public static final byte[] hexStringToByteArray(String hexEncodedBinary)
Convert hex string to binary byte array.

Parameters:
  `hexEncodedBinary` - - hex-encoded binary string
Returns:
  Byte array containing binary representation of input hex-encoded string
Throws:
  `IllegalArgumentException` - if string is not an even number of hex digits

### write

public void write(OutputStream os, String hexEncodedBinary) throws IOException
Input (hex) string is converted to binary and written to the output stream.

Parameters:
  `os` - output stream
  `hexEncodedBinary` - hex-encoded binary
Throws:
  `IOException` - when writing fails

### write

public void write(OutputStream os, InputStream is)

Parameters:
  `os` - - OutputStream for socket
  `is` - - InputStream to be written to Socket

### read

public String read(InputStream is) throws ReadException
Reads data until the defined EOM byte is reached. If there is no EOM byte defined, then reads until the end of the stream is reached. Response data is converted to hex-encoded binary

Parameters:
  `is` - - InputStream for socket
Returns:
  hex-encoded binary string
Throws:
  `ReadException` - when reading fails