org.apache.jmeter.protocol.tcp.sampler

## 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 org.apache.jmeter.protocol.tcp.sampler.AbstractTCPClient

      `eolByte, useEolByte`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BinaryTCPClientImpl()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static byte[]` | `hexStringToByteArray(java.lang.String hexEncodedBinary)` Convert hex string to binary byte array.
    `java.lang.String` | `read(java.io.InputStream is)` Deprecated.
    `java.lang.String` | `read(java.io.InputStream is, SampleResult sampleResult)` Reads data until the defined EOM byte is reached.
    `void` | `write(java.io.OutputStream os, java.io.InputStream is)`
    `void` | `write(java.io.OutputStream os, java.lang.String hexEncodedBinary)` Input (hex) string is converted to binary and written to the output stream.

    - ### Methods inherited from class org.apache.jmeter.protocol.tcp.sampler.AbstractTCPClient

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

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### BinaryTCPClientImpl

          public BinaryTCPClientImpl()

  - ### Method Detail

    - #### hexStringToByteArray

          public static byte[] hexStringToByteArray(java.lang.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:
        `java.lang.IllegalArgumentException` - if string is not an even number of hex digits

    - #### write

          public void write(java.io.OutputStream os,
                            java.lang.String hexEncodedBinary)
                     throws java.io.IOException

      Input (hex) string is converted to binary and written to the output stream.
      Parameters:
        `os` - output stream
        `hexEncodedBinary` - hex-encoded binary
      Throws:
        `java.io.IOException` - when writing fails

    - #### write

          public void write(java.io.OutputStream os,
                            java.io.InputStream is)

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

    - #### read

          @Deprecated
          public java.lang.String read(java.io.InputStream is)
                                            throws ReadException

      Deprecated.
      Parameters:
        `is` - - InputStream for socket
      Returns:
        String read from socket
      Throws:
        `ReadException` - exception that can contain partial response (Response until error occurred)

    - #### read

          public java.lang.String read(java.io.InputStream is,
                                       SampleResult sampleResult)
                                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
      Specified by:
        `read` in interface `TCPClient`
      Overrides:
        `read` in class `AbstractTCPClient`
      Parameters:
        `is` - - InputStream for socket
        `sampleResult` - `SampleResult`
      Returns:
        hex-encoded binary string
      Throws:
        `ReadException` - when reading fails
      See Also:
        `TCPClient.read(java.io.InputStream, org.apache.jmeter.samplers.SampleResult)`

Copyright © 1998-2018 Apache Software Foundation. All Rights Reserved.