Get the message as text.

If this is a binary message (that is, the message protocol does not define a charset), encodes it using Base64.

@return The message as text.
170878
public String messageAsText() {
        if (protocol.charset().isPresent()) {
            return message.decodeString(protocol.charset().get());
        } else {
            return Base64.getEncoder().encodeToString(message.toArray());
        }
    }
1207206
public String getMessage() 
   {
      String msg = super.getMessage();
      String ec = getErrorCode();
      if ((msg == null) && (ec == null)) 
      {
         return null;
      }
      if ((msg != null) && (ec != null)) 
      {
         return (msg + ", error code: " + ec);
      }
      return ((msg != null) ? msg : ("error code: " + ec));
   }
1368545
public BaseConvertToMessage getConvertToMessage()
    {
        if (m_convertToMessage == null)
        {
            BaseMessageHeader trxMessageHeader = this.getMessage().getMessageHeader();
            String strMessageClass = (String)trxMessageHeader.get(TrxMessageHeader.MESSAGE_MARSHALLER_CLASS);
            String strPackage = (String)trxMessageHeader.get(TrxMessageHeader.BASE_PACKAGE);
            strMessageClass = ClassServiceUtility.getFullClassName(strPackage, strMessageClass);
            m_convertToMessage = (BaseConvertToMessage)ClassServiceUtility.getClassService().makeObjectFromClassName(strMessageClass);
            if (m_convertToMessage != null)
            	m_convertToMessage.init(this);
        }
        return m_convertToMessage;
    }
684291
public synchronized String getText() {
        if(lines.length == 0) {
            return "";
        }
        StringBuilder bob = new StringBuilder(lines[0]);
        for(int i = 1; i < lines.length; i++) {
            bob.append("\n").append(lines[i]);
        }
        return bob.toString();
    }
197617
protected String getBase64(InputStream in) throws IOException {
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		CopyUtil.copy(in, out);
		return new String(Base64.encodeBase64(out.toByteArray()), "UTF-8"); //$NON-NLS-1$
	}
293271
public String getTexTextValue() {
		String text = value;
		if ((text != null) && (text.trim().length() > 0)) {
			Enumeration e = bundle.getKeys();
			while (e.hasMoreElements()) {
				String key = (String) e.nextElement();
				if (text.indexOf(key) != -1)
					text = stringReplace(text, key, bundle.getString(key));
			}
		}
		return text;
	}
1049578
public int getMessageLength() {
		int length = 1;

		if (this.matchingIds != null) {
			for (String id : this.matchingIds) {
				try {
					length += 4;
					length += id.getBytes("UTF-16BE").length;
				} catch (UnsupportedEncodingException uee) {
					log.error("Unable to encode UTF-16BE String: {}", uee);
				}
			}
		}
		return length;
	}
242037
public static byte[] decode(String text) throws Exception
	{
		if (text.length() % 4 != 0)
		{
			throw new Exception("Base64 not a multiple of 4 bytes");
		}

		byte[] result = new byte[text.length() / 4 * 3];
		int p = 0;

		for (int i = 0; i < text.length();)
		{
			if (text.charAt(i) == '\n')
			{
				continue;
			}

			int b1 = b64decode(text.charAt(i++));
			int b2 = b64decode(text.charAt(i++));
			int b3 = b64decode(text.charAt(i++));
			int b4 = b64decode(text.charAt(i++));

			if (b4 >= 0)
			{
				int three = b4 | b3 << 6 | b2 << 12 | b1 << 18;
				result[p++] = (byte) ((three & 0xff0000) >> 16);
				result[p++] = (byte) ((three & 0xff00) >> 8);
				result[p++] = (byte) (three & 0xff);
			} else if (b3 >= 0)
			{
				int two = b3 << 6 | b2 << 12 | b1 << 18;
				result[p++] = (byte) ((two & 0xff0000) >> 16);
				result[p++] = (byte) ((two & 0xff00) >> 8);
			} else
			{
				int one = b2 << 12 | b1 << 18;
				result[p++] = (byte) ((one & 0xff0000) >> 16);
			}
		}

		byte[] output = new byte[p];
		System.arraycopy(result, 0, output, 0, p);

		return output;
	}
622501
public int getMessageLength(){
		if(this.identifierRegex == null){
			return 1;
		}
		try {
			return this.identifierRegex.getBytes("UTF-16BE").length + 1;
		} catch (UnsupportedEncodingException e) {
			log.error("Unable to decode UTF-16BE String: {}", e);
			return 1;
		}
	}
569239
public int getMessageLength() {
		// Message type
		int messageLength = 1;

		// Number of aliases
		messageLength += 4;

		if (this.aliases != null) {
			for (OriginAlias alias : this.aliases) {
				// Alias number, name length
				messageLength += 8;
				try {
					messageLength += alias.origin.getBytes("UTF-16BE").length;
				} catch (UnsupportedEncodingException e) {
					log.error("Unable to encode strings into UTF-16.");
					e.printStackTrace();
				}
			}
		}

		return messageLength;
	}
1200068
public String getText() {
        if (sqlTextStr == null) {
            sqlTextStr = new String(sqlText, Constants.UTF8ENCODING);
        }
        return sqlTextStr;
    }
104404
public function getBinaryMessage()
    {
        $encodedPayload = $this->jsonEncode($this->payload->getPayload());

        return chr(0).
               chr(0).
               chr(32).
               pack('H*', $this->deviceToken).
               chr(0).chr(strlen($encodedPayload)).
               $encodedPayload;
    }
1263932
public String getText()
    {
        StringBuilder text = new StringBuilder();
        Token t = firstToken;
        while ( t!=null ) {
            text.append(t.image);
            if ( !t.image.equals(".") )
                text.append(" ");
            if ( t==lastToken ||
                t.image.equals("{") || t.image.equals(";") )
                break;
            t=t.next;
        }

        return text.toString();
    }
1091683
public String getString() {
		final int len = getVInt();
		final byte[] utf = new byte[len];
		System.arraycopy(buf, bufPosition, utf, 0, utf.length);
		bufPosition += utf.length;
		return new String(utf, 0, len, charsetUTF8);
	}
125733
@Nonnull
  public static String getExpandedMessage (@Nonnull final String sMsg)
  {
    final char cCheck = sMsg.length () == 8 ? sMsg.charAt (7) : '\u0000';
    final String sUpce = sMsg.substring (0, 0 + 7);
    final byte nNumberSystem = _extractNumberSystem (sUpce);
    if (nNumberSystem != 0 && nNumberSystem != 1)
      throw new IllegalArgumentException ("Invalid UPC-E message: " + sMsg);

    final StringBuilder aSB = new StringBuilder ();
    aSB.append (Byte.toString (nNumberSystem));
    final byte nMode = StringParser.parseByte (sUpce.substring (6, 6 + 1), (byte) -1);
    if (nMode >= 0 && nMode <= 2)
    {
      aSB.append (sUpce.substring (1, 1 + 2));
      aSB.append (Byte.toString (nMode));
      aSB.append ("0000");
      aSB.append (sUpce.substring (3, 3 + 3));
    }
    else
      if (nMode == 3)
      {
        aSB.append (sUpce.substring (1, 1 + 3));
        aSB.append ("00000");
        aSB.append (sUpce.substring (4, 4 + 2));
      }
      else
        if (nMode == 4)
        {
          aSB.append (sUpce.substring (1, 1 + 4));
          aSB.append ("00000");
          aSB.append (sUpce.substring (5, 5 + 1));
        }
        else
          if (nMode >= 5 && nMode <= 9)
          {
            aSB.append (sUpce.substring (1, 1 + 5));
            aSB.append ("0000");
            aSB.append (Byte.toString (nMode));
          }
          else
          {
            // Shouldn't happen
            throw new IllegalArgumentException ("Internal error");
          }
    final String sUpcaFinished = aSB.toString ();
    final char cExpectedCheck = calcChecksumChar (sUpcaFinished, sUpcaFinished.length ());
    if (cCheck != '\u0000' && cCheck != cExpectedCheck)
      throw new IllegalArgumentException ("Invalid checksum. Expected " + cExpectedCheck + " but was " + cCheck);

    return sUpcaFinished + cExpectedCheck;
  }
1163771
@Override
    public String getFormattedMessage() {
        if (formattedMessage != null) {
            return formattedMessage;
        }
        final StringBuilder sb = new StringBuilder(255);
        formatTo(sb);
        return sb.toString();
    }
1113158
public String text() {
        try {
            connect();
            return responseCode() >= 400 ? read(connection.getErrorStream()) : read(connection.getInputStream());
        } catch (IOException e) {
            throw new HttpException("Failed URL: " + url, e);
        }finally {
            dispose();
        }
    }