/** * Convert the bytes into a String. * * @param b the bytes * @return the String * @since JavaMail 1.4.4 */ public static String toString(byte[] b) { return toString(b, 0, b.length); }
/** * Convert the bytes into a String. * * @param b the bytes * @return the String * @since JavaMail 1.4.4 */ public static String toString(byte[] b) { return toString(b, 0, b.length); }
public String toString() { return ASCIIUtility.toString(buffer, 0, size); }
private String toString(byte[] buffer, int start, int end) { return utf8 ? new String(buffer, start, end - start, StandardCharsets.UTF_8) : ASCIIUtility.toString(buffer, start, end); }
/** * Return the rest of the response as a string, usually used to * return the arbitrary message text after a NO response. * * @return the rest of the response */ public String getRest() { skipSpaces(); return ASCIIUtility.toString(buffer, index, size); }
@Override String getInitialResponse(String host, String authzid, String user, String passwd) throws MessagingException, IOException { String resp = "user=" + user + "\001auth=Bearer " + passwd + "\001\001"; byte[] b = BASE64EncoderStream.encode( resp.getBytes(StandardCharsets.UTF_8)); return ASCIIUtility.toString(b); }
/** * Extract a string stopping at control characters or any * character in delim. */ private String readDelimString(String delim) { skipSpaces(); if (index >= size) // already at end of response return null; byte b; int start = index; while (index < size && ((b = buffer[index]) > ' ') && delim.indexOf((char)b) < 0 && b >= ' ' && b != 0x7f) index++; return ASCIIUtility.toString(buffer, start, index); }
/** * Read a string as an arbitrary sequence of characters, * stopping at the delimiter Used to read part of a * response code inside []. * * @param delim the delimiter character * @return the string */ public String readString(char delim) { skipSpaces(); if (index >= size) // already at end of response return null; int start = index; while (index < size && buffer[index] != delim) index++; return ASCIIUtility.toString(buffer, start, index); }
@Override String getInitialResponse(String host, String authzid, String user, String passwd) throws MessagingException, IOException { // return "authzid<NUL>user<NUL>passwd" ByteArrayOutputStream bos = new ByteArrayOutputStream(); OutputStream b64os = new BASE64EncoderStream(bos, Integer.MAX_VALUE); if (authzid != null) b64os.write(authzid.getBytes(StandardCharsets.UTF_8)); b64os.write(0); b64os.write(user.getBytes(StandardCharsets.UTF_8)); b64os.write(0); b64os.write(passwd.getBytes(StandardCharsets.UTF_8)); b64os.flush(); // complete the encoding return ASCIIUtility.toString(bos.toByteArray()); }
String getInitialResponse(String host, String authzid, String user, String passwd) throws MessagingException, IOException { // return "authzid<NUL>user<NUL>passwd" ByteArrayOutputStream bos = new ByteArrayOutputStream(); OutputStream b64os = new BASE64EncoderStream(bos, Integer.MAX_VALUE); if (authzid != null) b64os.write(ASCIIUtility.getBytes(authzid)); b64os.write(0); b64os.write(ASCIIUtility.getBytes(user)); b64os.write(0); b64os.write(ASCIIUtility.getBytes(passwd)); b64os.flush(); // complete the encoding return ASCIIUtility.toString(bos.toByteArray()); }
String getInitialResponse(String host, String authzid, String user, String passwd) throws MessagingException, IOException { String resp = "user=" + user + "\001auth=Bearer " + passwd + "\001\001"; byte[] b = BASE64EncoderStream.encode(ASCIIUtility.getBytes(resp)); return ASCIIUtility.toString(b); }
if (digit < 0) { throw new NumberFormatException( "illegal number: " + toString(b, start, end) ); } else {
if (digit < 0) { throw new NumberFormatException( "illegal number: " + toString(b, start, end) ); } else {
if (digit < 0) { throw new NumberFormatException( "illegal number: " + toString(b, start, end) ); } else {
if (digit < 0) { throw new NumberFormatException( "illegal number: " + toString(b, start, end) ); } else {