public void flush() { try { // flush any bytes we have if (bufsize > 0) { encode(); bufsize = 0; } // write the terminating character of the encoding if (started) { out.write('-'); started = false; } } catch (IOException e) { //e.printStackTrace(); } }
public void write(int c) { try { // write out the initial character if this is the first time if (!started) { started = true; out.write('&'); } // we write each character as a 2 byte unicode character buffer[bufsize++] = (byte) (c >> 8); buffer[bufsize++] = (byte) (c & 0xff); if (bufsize >= 3) { encode(); bufsize -= 3; } } catch (IOException e) { //e.printStackTrace(); } }
public void flush() { try { // flush any bytes we have if (bufsize > 0) { encode(); bufsize = 0; } // write the terminating character of the encoding if (started) { out.write('-'); started = false; } } catch (IOException e) { //e.printStackTrace(); } }
public void write(int c) { try { // write out the initial character if this is the first time if (!started) { started = true; out.write('&'); } // we write each character as a 2 byte unicode character buffer[bufsize++] = (byte) (c >> 8); buffer[bufsize++] = (byte) (c & 0xff); if (bufsize >= 3) { encode(); bufsize -= 3; } } catch (IOException e) { //e.printStackTrace(); } }
/** * Encode a mailbox name appropriately depending on whether or not * the server supports UTF-8, and add the encoded name to the * Argument. * * @param args the arguments * @param name the name to encode * @since JavaMail 1.6.0 */ protected void writeMailboxName(Argument args, String name) { if (utf8) args.writeString(name, StandardCharsets.UTF_8); else // encode the mbox as per RFC2060 args.writeString(BASE64MailboxEncoder.encode(name)); }
/** * RENAME Command. * * @param o old mailbox name * @param n new mailbox name * @exception ProtocolException for protocol failures * @see "RFC2060, section 6.3.5" */ public void rename(String o, String n) throws ProtocolException { // encode the mbox as per RFC2060 o = BASE64MailboxEncoder.encode(o); n = BASE64MailboxEncoder.encode(n); Argument args = new Argument(); args.writeString(o); args.writeString(n); simpleCommand("RENAME", args); }
/** * CREATE Command. * * @param mbox the mailbox to create * @exception ProtocolException for protocol failures * @see "RFC2060, section 6.3.3" */ public void create(String mbox) throws ProtocolException { // encode the mbox as per RFC2060 mbox = BASE64MailboxEncoder.encode(mbox); Argument args = new Argument(); args.writeString(mbox); simpleCommand("CREATE", args); }
/** * SUBSCRIBE Command. * * @param mbox the mailbox * @exception ProtocolException for protocol failures * @see "RFC2060, section 6.3.6" */ public void subscribe(String mbox) throws ProtocolException { Argument args = new Argument(); // encode the mbox as per RFC2060 mbox = BASE64MailboxEncoder.encode(mbox); args.writeString(mbox); simpleCommand("SUBSCRIBE", args); }
/** * UNSUBSCRIBE Command. * * @param mbox the mailbox * @exception ProtocolException for protocol failures * @see "RFC2060, section 6.3.7" */ public void unsubscribe(String mbox) throws ProtocolException { Argument args = new Argument(); // encode the mbox as per RFC2060 mbox = BASE64MailboxEncoder.encode(mbox); args.writeString(mbox); simpleCommand("UNSUBSCRIBE", args); }
/** * DELETE Command. * * @param mbox the mailbox to delete * @exception ProtocolException for protocol failures * @see "RFC2060, section 6.3.4" */ public void delete(String mbox) throws ProtocolException { // encode the mbox as per RFC2060 mbox = BASE64MailboxEncoder.encode(mbox); Argument args = new Argument(); args.writeString(mbox); simpleCommand("DELETE", args); }
mbox = BASE64MailboxEncoder.encode(mbox);
/** * DELETEACL Command. * * @param mbox the mailbox * @param user the user * @exception ProtocolException for protocol failures * @see "RFC2086" */ public void deleteACL(String mbox, String user) throws ProtocolException { if (!hasCapability("ACL")) throw new BadCommandException("ACL not supported"); // encode the mbox as per RFC2060 mbox = BASE64MailboxEncoder.encode(mbox); Argument args = new Argument(); args.writeString(mbox); args.writeString(user); Response[] r = command("DELETEACL", args); Response response = r[r.length-1]; // dispatch untagged responses notifyResponseHandlers(r); handleResult(response); }
private CopyUID copyuid(String msgSequence, String mbox, boolean uid) throws ProtocolException { if (uid && !hasCapability("UIDPLUS")) throw new BadCommandException("UIDPLUS not supported"); // encode the mbox as per RFC2060 mbox = BASE64MailboxEncoder.encode(mbox); Argument args = new Argument(); args.writeAtom(msgSequence); args.writeString(mbox); Response[] r = command("COPY", args); // dispatch untagged responses notifyResponseHandlers(r); // Handle result of this command handleResult(r[r.length-1]); if (uid) return getCopyUID(r); else return null; }
/** * MOVE Command, return uid from COPYUID response code. * * @see "RFC 6851" * @see "RFC 4315, section 3" * @since JavaMail 1.5.4 */ private CopyUID moveuid(String msgSequence, String mbox, boolean uid) throws ProtocolException { if (!hasCapability("MOVE")) throw new BadCommandException("MOVE not supported"); if (uid && !hasCapability("UIDPLUS")) throw new BadCommandException("UIDPLUS not supported"); // encode the mbox as per RFC2060 mbox = BASE64MailboxEncoder.encode(mbox); Argument args = new Argument(); args.writeAtom(msgSequence); args.writeString(mbox); Response[] r = command("MOVE", args); // dispatch untagged responses notifyResponseHandlers(r); // Handle result of this command handleResult(r[r.length-1]); if (uid) return getCopyUID(r); else return null; }
/** * SETACL Command. * * @param mbox the mailbox * @param modifier the ACL modifier * @param acl the ACL * @exception ProtocolException for protocol failures * @see "RFC2086" */ public void setACL(String mbox, char modifier, ACL acl) throws ProtocolException { if (!hasCapability("ACL")) throw new BadCommandException("ACL not supported"); // encode the mbox as per RFC2060 mbox = BASE64MailboxEncoder.encode(mbox); Argument args = new Argument(); args.writeString(mbox); args.writeString(acl.getName()); String rights = acl.getRights().toString(); if (modifier == '+' || modifier == '-') rights = modifier + rights; args.writeString(rights); Response[] r = command("SETACL", args); Response response = r[r.length-1]; // dispatch untagged responses notifyResponseHandlers(r); handleResult(response); }
mbox = BASE64MailboxEncoder.encode(mbox);
throws ProtocolException { mbox = BASE64MailboxEncoder.encode(mbox);
public AppendUID appenduid(String mbox, Flags f, Date d, Literal data, boolean uid) throws ProtocolException { mbox = BASE64MailboxEncoder.encode(mbox);
throws ProtocolException { mbox = BASE64MailboxEncoder.encode(mbox);