private OutputStream startLiteral(Protocol protocol, int size) throws IOException, ProtocolException { DataOutputStream os = (DataOutputStream)protocol.getOutputStream(); boolean nonSync = protocol.supportsNonSyncLiterals(); os.write('{'); os.writeBytes(Integer.toString(size)); if (nonSync) // server supports non-sync literals os.writeBytes("+}\r\n"); else os.writeBytes("}\r\n"); os.flush(); // If we are using synchronized literals, wait for the server's // continuation signal if (!nonSync) { for (; ;) { Response r = protocol.readResponse(); if (r.isContinuation()) break; if (r.isTagged()) throw new LiteralException(r); // XXX - throw away untagged responses; // violates IMAP spec, hope no servers do this } } return os; } }
private OutputStream startLiteral(Protocol protocol, int size) throws IOException, ProtocolException { DataOutputStream os = (DataOutputStream)protocol.getOutputStream(); boolean nonSync = protocol.supportsNonSyncLiterals(); os.write('{'); os.writeBytes(Integer.toString(size)); if (nonSync) // server supports non-sync literals os.writeBytes("+}\r\n"); else os.writeBytes("}\r\n"); os.flush(); // If we are using synchronized literals, wait for the server's // continuation signal if (!nonSync) { for (; ;) { Response r = protocol.readResponse(); if (r.isContinuation()) break; if (r.isTagged()) throw new LiteralException(r); // XXX - throw away untagged responses; // violates IMAP spec, hope no servers do this } } return os; } }
/** * Extract a NSTRING, starting at the current position. Return it as * a ByteArray. The sequence 'NIL' is returned as null * * NSTRING := QuotedString | Literal | "NIL" * * @return a ByteArray */ public ByteArray readByteArray() { /* * Special case, return the data after the continuation uninterpreted. * It's usually a challenge for an AUTHENTICATE command. */ if (isContinuation()) { skipSpaces(); return new ByteArray(buffer, index, size - index); } return (ByteArray)parseString(false, false); }
/** * Extract a NSTRING, starting at the current position. Return it as * a ByteArray. The sequence 'NIL' is returned as null * * NSTRING := QuotedString | Literal | "NIL" * * @return a ByteArray */ public ByteArray readByteArray() { /* * Special case, return the data after the continuation uninterpreted. * It's usually a challenge for an AUTHENTICATE command. */ if (isContinuation()) { skipSpaces(); return new ByteArray(buffer, index, size - index); } return (ByteArray)parseString(false, false); }
if (r.isContinuation() || r.isBYE()) done = true; if (!r.isContinuation()) handleResult(r);
if (r.isContinuation() || r.isBYE()) done = true; if (!r.isContinuation()) handleResult(r);
try { r = readResponse(); if (r.isContinuation()) {
try { r = readResponse(); if (r.isContinuation()) {
try { r = readResponse(); if (r.isContinuation()) {
try { r = readResponse(); if (r.isContinuation()) {
try { r = readResponse(); if (r.isContinuation()) {
try { r = readResponse(); if (r.isContinuation()) {
try { r = readResponse(); if (r.isContinuation()) {
try { r = readResponse(); if (r.isContinuation()) {
try { r = pr.readResponse(); if (r.isContinuation()) { byte[] ba = null; if (!sc.isComplete()) {
try { r = pr.readResponse(); if (r.isContinuation()) { byte[] ba = null; if (!sc.isComplete()) {
/** * Extract a NSTRING, starting at the current position. Return it as * a ByteArray. The sequence 'NIL' is returned as null * * NSTRING := QuotedString | Literal | "NIL" * * @return a ByteArray */ public ByteArray readByteArray() { /* * Special case, return the data after the continuation uninterpreted. * It's usually a challenge for an AUTHENTICATE command. */ if (isContinuation()) { skipSpaces(); return new ByteArray(buffer, index, size - index); } return (ByteArray)parseString(false, false); }
/** * Extract a NSTRING, starting at the current position. Return it as * a ByteArray. The sequence 'NIL' is returned as null * * NSTRING := QuotedString | Literal | "NIL" * * @return a ByteArray */ public ByteArray readByteArray() { /* * Special case, return the data after the continuation uninterpreted. * It's usually a challenge for an AUTHENTICATE command. */ if (isContinuation()) { skipSpaces(); return new ByteArray(buffer, index, size - index); } return (ByteArray)parseString(false, false); }
/** * Extract a NSTRING, starting at the current position. Return it as * a ByteArray. The sequence 'NIL' is returned as null * * NSTRING := QuotedString | Literal | "NIL" * * @return a ByteArray */ public ByteArray readByteArray() { /* * Special case, return the data after the continuation uninterpreted. * It's usually a challenge for an AUTHENTICATE command. */ if (isContinuation()) { skipSpaces(); return new ByteArray(buffer, index, size - index); } return (ByteArray)parseString(false, false); }
/** * Extract a NSTRING, starting at the current position. Return it as * a ByteArray. The sequence 'NIL' is returned as null * * NSTRING := QuotedString | Literal | "NIL" * * @return a ByteArray */ public ByteArray readByteArray() { /* * Special case, return the data after the continuation uninterpreted. * It's usually a challenge for an AUTHENTICATE command. */ if (isContinuation()) { skipSpaces(); return new ByteArray(buffer, index, size - index); } return (ByteArray)parseString(false, false); }