message content is binary or not.
976402
public function export()
    {
        $out = array();
        if (Encoding::is_binary_data($this->content)) {
            $out['content-bin'] = base64_encode($this->content);
        } else {
            $out['content'] = $this->content;
        }
        return $out;
    }
451138
private void verifyMagicBytes(TLVInputStream input) throws InvalidPublicationsFileException {
        try {
            byte[] magicBytes = new byte[PUBLICATIONS_FILE_MAGIC_BYTES_LENGTH];
            input.read(magicBytes);
            if (!Arrays.equals(magicBytes, FILE_BEGINNING_MAGIC_BYTES)) {
                throw new InvalidPublicationsFileException("Invalid publications file magic bytes");
            }
        } catch (IOException e) {
            throw new InvalidPublicationsFileException("Checking publications file magic bytes failed", e);
        }
    }
1083094
function (msg, knownComputations) {
    if (msg.data && msg.data.byteLength) {
      // The presence of byteLength indicates data is an ArrayBuffer from a WebSocket data frame.
      return parseBinaryMessage(msg.data, knownComputations);
    } else if (msg.type) {
      // Otherwise it's JSON in a WebSocket text frame.
      return JSON.parse(msg.data);
    } else {
      console.warn('Unrecognized websocket message.');
      return null;
    }
  }
435165
public static boolean isTransferEncodingChunked(HttpMessage message) {
        return message.headers().contains(HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED, true);
    }
382573
def message_from_binary_file(fp, *args, **kws):
    
    from future.backports.email.parser import BytesParser
    return BytesParser(*args, **kws).parse(fp)
1247613
def log_binary(logger, message, **kwargs):
    """"""
    if logger.isEnabledFor(logging.DEBUG):
        output = ('{0}={1}'.format(k, binascii.hexlify(
            bytearray(v)).decode()) for k, v in sorted(kwargs.items()))
        logger.debug('%s (%s)', message, ', '.join(output))
1138375
public function isBinary()
    {
        if (is_string($this->data)) {
            $mime = MimeType::getMimeTypeByContent($this->data);

            return (strpos($mime, 'text') !== 0 && $mime !== 'application/x-empty');
        }

        return false;
    }
768562
private boolean hasMessageBody() throws IOException {
    int statusCode = getStatusCode();
    if (getRequest().getRequestMethod().equals(HttpMethods.HEAD)
        || statusCode / 100 == 1
        || statusCode == HttpStatusCodes.STATUS_CODE_NO_CONTENT
        || statusCode == HttpStatusCodes.STATUS_CODE_NOT_MODIFIED) {
      ignore();
      return false;
    }
    return true;
  }
866572
def ensure_binary_encoding(string)
      raise ArgumentError, "String is missing" if !string
      if string.encoding == Encoding::BINARY
        string
      else
        string.b
      end
    end
587497
function isDataBinaryRobust(data) {
  // console.log('data is binary ?')
  var patternVertex = /vertex[\s]+([\-+]?[0-9]+\.?[0-9]*([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+/g;
  var text = ensureString(data);
  var isBinary = patternVertex.exec(text) === null;
  return isBinary;
}
698658
function matchBinaries (input, binary) {
  const regExp = bytecodeToBytecodeRegex(binary);
  return (input.match(regExp) !== null);
}
210777
def write_message(self, data, binary=False):
        
        self.connection.write_message(data, binary)
659340
def _decode_received(self, msg):
        """"""
        if not isinstance(msg, six.binary_type):
            # already decoded - do nothing
            return msg
        # only decode from utf-8 if message is not binary data
        type = six.byte2int(msg[0:1])
        if type >= 48:  # no binary
            return msg.decode('utf-8')
        # binary message, don't try to decode
        return msg
107891
def isbinary(*args):
    """"""
    return all(map(lambda c: isnumber(c) or isbool(c), args))
616897
private void logBinaryStringInfo(StringBuilder binaryString) {

        encodeInfo += "Binary Length: " + binaryString.length() + "\n";
        encodeInfo += "Binary String: ";

        int nibble = 0;
        for (int i = 0; i < binaryString.length(); i++) {
            switch (i % 4) {
                case 0:
                    if (binaryString.charAt(i) == '1') {
                        nibble += 8;
                    }
                    break;
                case 1:
                    if (binaryString.charAt(i) == '1') {
                        nibble += 4;
                    }
                    break;
                case 2:
                    if (binaryString.charAt(i) == '1') {
                        nibble += 2;
                    }
                    break;
                case 3:
                    if (binaryString.charAt(i) == '1') {
                        nibble += 1;
                    }
                    encodeInfo += Integer.toHexString(nibble);
                    nibble = 0;
                    break;
            }
        }

        if ((binaryString.length() % 4) != 0) {
            encodeInfo += Integer.toHexString(nibble);
        }

        encodeInfo += "\n";
    }
268135
private static boolean castToBool(byte[] data) {
        for (int i = 0; i < data.length; i++)
        {
            // "Can be negative zero" - Bitcoin Core (see OpenSSL's BN_bn2mpi)
            if (data[i] != 0)
                return !(i == data.length - 1 && (data[i] & 0xFF) == 0x80);
        }
        return false;
    }
930456
def is10(msg):
    

    if allzeros(msg):
        return False

    d = hex2bin(data(msg))

    # first 8 bits must be 0x10
    if d[0:8] != '00010000':
        return False

    # bit 10 to 14 are reserved
    if bin2int(d[9:14]) != 0:
        return False

    # overlay capabilty conflict
    if d[14] == '1' and bin2int(d[16:23]) < 5:
        return False
    if d[14] == '0' and bin2int(d[16:23]) > 4:
        return False

    return True