Main Content

show

Class: matlab.net.http.MessageBody
Package: matlab.net.http

Display or return formatted version of message body data

Description

example

show(body) displays the entire Data property of a message body if Data is a scalar string or character vector. For other types, the method displays a message indicating the length of the data in bytes, if known. If length is unknown, then the value displayed is the length of the data if body were sent in a request message.

The show method formats Data when possible. For example, the method puts separators between parts of a multipart message and separately converts each part to a string. If Data is a string or character vector, then the string and show methods return the same value.

Use this method for diagnostics or debugging.

example

show(body,maxlength) displays the first maxlength characters of Data. If Data is longer than maxlength characters, then the method displays the total length of the data.

str = show(___) returns a string containing the information to be displayed, and can include any of the input arguments in previous syntaxes.

Input Arguments

expand all

Message body, specified as a matlab.net.http.MessageBody object.

Number of bytes to convert, specified as an integer.

Examples

expand all

Display data about an image received from the Hubble Heritage website.

req = matlab.net.http.RequestMessage;
uri = matlab.net.URI('http://heritage.stsci.edu/2007/14/images/p0714aa.jpg');
r = send(req,uri);
show(r.Body)
<< 201317 bytes of image/jpeg data >>

Request the MATLAB webread documentation from mathworks.com.

uri = matlab.net.URI('https://www.mathworks.com/help/matlab/ref/webread.html');
request = matlab.net.http.RequestMessage;
r = send(request,uri);

Display the first 100 characters of the message body.

show(r.Body,100)
<!DOCTYPE HTML>
<html>
<head>
<title>Read content from RESTful web service - MATLAB webread</title>


<< 94866 total characters of text/html UTF-8 data >>
Introduced in R2016b