/** * Write out given Literal as a literal. */ private void literal(Literal b, Protocol protocol) throws IOException, ProtocolException { b.writeTo(startLiteral(protocol, b.size())); }
/** * Read a new Response from the given Protocol * * @param p the Protocol object * @exception IOException for I/O errors * @exception ProtocolException for protocol failures */ public Response(Protocol p) throws IOException, ProtocolException { // read one response into 'buffer' ByteArray ba = p.getResponseBuffer(); ByteArray response = p.getInputStream().readResponse(ba); buffer = response.getBytes(); size = response.getCount() - 2; // Skip the terminating CRLF parse(); }
protected void processGreeting(Response r) throws ProtocolException { if (r.isBYE()) throw new ConnectionException(this, r); }
protected Argument from(String address, String charset) throws SearchException, IOException { Argument result = new Argument(); result.writeAtom("FROM"); result.writeString(address, charset); return result; }
/** * Extract a NSTRING, starting at the current position. Return it as * a ByteArrayInputStream. The sequence 'NIL' is returned as null * * NSTRING := QuotedString | Literal | "NIL" * * @return a ByteArrayInputStream */ public ByteArrayInputStream readBytes() { ByteArray ba = readByteArray(); if (ba != null) return ba.toByteArrayInputStream(); else return null; }
public ByteArrayInputStream getByteArrayInputStream() { if (data != null) return data.toByteArrayInputStream(); else return null; }
Response[] r = protocol.command("FETCH", args); Response response = r[r.length - 1]; if (response.isOK()) { Properties props = new Properties(); props.setProperty("mail.store.protocol", "imap");
/** * Constructs a ProtocolException with the specified Response object. * * @param r the Response */ public ProtocolException(Response r) { super(r.toString()); response = r; }
/** * Read a Response from the InputStream. * * @return ByteArray that contains the Response * @exception IOException for I/O errors */ public ByteArray readResponse() throws IOException { return readResponse(null); }
/** * Extract a NSTRING, starting at the current position. Return it as * a String. The sequence 'NIL' is returned as null * * NSTRING := QuotedString | Literal | "NIL" * * @return a String */ public String readString() { return (String)parseString(false, true); }
/** * Close socket connection. * * This method just makes the Protocol.disconnect() method * public. */ @Override public void disconnect() { super.disconnect(); authenticated = false; // just in case }
/** * Extract an ATOM, starting at the current position. Updates * the internal index to beyond the Atom. * * @return an Atom */ public String readAtom() { return readDelimString(ATOM_CHAR_DELIM); }
/** * Write out given String as either an Atom, QuotedString or Literal */ private void astring(byte[] bytes, Protocol protocol) throws IOException, ProtocolException { nastring(bytes, protocol, false); }
/** * Write out given Literal as a literal. */ private void literal(Literal b, Protocol protocol) throws IOException, ProtocolException { b.writeTo(startLiteral(protocol, b.size())); }
protected void processGreeting(Response r) throws ProtocolException { if (r.isBYE()) throw new ConnectionException(this, r); }
public ByteArrayInputStream getByteArrayInputStream() { if (data != null) return data.toByteArrayInputStream(); else return null; }
/** * Constructs a LiteralException with the specified Response object. * * @param r the response object */ public LiteralException(Response r) { super(r.toString()); response = r; } }
/** * Read a Response from the InputStream. * * @return ByteArray that contains the Response * @exception IOException for I/O errors */ public ByteArray readResponse() throws IOException { return readResponse(null); }
/** * Extract an ATOM, starting at the current position. Updates * the internal index to beyond the Atom. * * @return an Atom */ public String readAtom() { return readDelimString(ATOM_CHAR_DELIM); }
public ByteArrayInputStream getByteArrayInputStream() { if (data != null) return data.toByteArrayInputStream(); else return null; }