Main Content

show

类: matlab.net.http.Message
命名空间: matlab.net.http

显示或返回消息的格式化版本

说明

show(msg) 在命令行窗口中显示整个消息,包括 HeaderBody 属性。如果 Body 包含不能转换为字符的二进制数据,此方法将显示指示数据长度(以字节为单位)的消息。

可以使用此语法进行诊断或调试。

示例

show(msg,maxlength) 显示 Body 的前 maxlength 个字符。如果 Body 超过 maxlength 个字符,此方法将显示数据的总长度。

str = show(___) 返回一个字符串,其中包含要显示的信息,且可包含上述语法中的任何输入参量。

输入参数

全部展开

消息,指定为 matlab.net.http.Message 对象或由 Message 对象组成的向量。

要转换的字节数,指定为整数。

示例

全部展开

仅显示来自 mathworks.com 的消息主体中的前 100 个字符。MATLAB 将显示指示消息主体中字符总数的文本。

request = matlab.net.http.RequestMessage;
uri = matlab.net.URI('https://www.mathworks.com');
r = send(request,uri);
show(r,100)
HTTP/1.1 200 OK
Date: Mon, 02 Oct 2017 12:55:05 GMT
Server: Apache/2.2.15 (CentOS)
Host-ID: wcxm4
X-Content-Type-Options: nosniff
Last-Modified: Sun, 01 Oct 2017 16:57:27 GMT
ETag: "f4b6"
Accept-Ranges: bytes
Cache-Control: max-age=14400
Expires: Mon, 02 Oct 2017 16:55:05 GMT
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 9500
Content-Type: text/html; charset=UTF-8
Connection: close

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-w

<< 62581 total characters of text/html UTF-8 data >>

版本历史记录

在 R2016b 中推出