ba = new ByteArray(new byte[128], 0, 128); byte[] buffer = ba.getBytes(); int idx = 0; for (;;) { // read until CRLF with no preceeding literal if (incr > maxIncrement) incr = maxIncrement; ba.grow(incr); buffer = ba.getBytes(); if (count + incrementSlop > avail) { ba.grow(minIncrement > count + incrementSlop - avail ? minIncrement : count + incrementSlop - avail); buffer = ba.getBytes(); ba.setCount(idx); return ba;
public ByteArrayInputStream getByteArrayInputStream() { if (data != null) return data.toByteArrayInputStream(); else return null; }
/** * 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(); }
/** * 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); }
byte[] ba = null; if (!sc.isComplete()) { ba = r.readByteArray().getNewBytes(); if (ba.length > 0) ba = BASE64DecoderStream.decode(ba);
/** * Returns size of the message * * @param folder Folder containing the message * @param uid Message UID * @return Returns size of the message * @throws MessagingException */ private static Integer getMessageSize(IMAPFolder folder, final Long uid) throws MessagingException { return getMessageBody(folder, uid).getByteArray().getCount(); }
/** * 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 utf8 = p.supportsUtf8(); parse(); }
return toString(buffer, start, copyto); else return new ByteArray(buffer, start, copyto-start); } else if (b == '{') { // Literal int start = ++index; // note the start position return toString(buffer, start, start + count); else return new ByteArray(buffer, start, count); } else if (parseAtoms) { // parse as ASTRING-CHARs int start = index; // track this, so that we can use to return s; else // *very* unlikely return new ByteArray(buffer, start, index); } else if (b == 'N' || b == 'n') { // the only valid value is 'NIL' index += 3; // skip past NIL
byte[] ba = null; if (!sc.isComplete()) { ba = r.readByteArray().getNewBytes(); if (ba.length > 0) ba = BASE64DecoderStream.decode(ba);
ba = new ByteArray(new byte[128], 0, 128); byte[] buffer = ba.getBytes(); int idx = 0; for (;;) { // read until CRLF with no preceeding literal if (incr > maxIncrement) incr = maxIncrement; ba.grow(incr); buffer = ba.getBytes(); if (count + incrementSlop > avail) { ba.grow(minIncrement > count + incrementSlop - avail ? minIncrement : count + incrementSlop - avail); buffer = ba.getBytes(); ba.setCount(idx); return ba;
/** * Read a new Response from the given Protocol * @param p the Protocol object */ 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(); }
public ByteArrayInputStream getByteArrayInputStream() { if (data != null) return data.toByteArrayInputStream(); else return null; }
return ASCIIUtility.toString(buffer, start, copyto); else return new ByteArray(buffer, start, copyto-start); } else if (b == '{') { // Literal int start = ++index; // note the start position return ASCIIUtility.toString(buffer, start, start + count); else return new ByteArray(buffer, start, count); } else if (parseAtoms) { // parse as ASTRING-CHARs int start = index; // track this, so that we can use to return s; else // *very* unlikely return new ByteArray(buffer, start, index); } else if (b == 'N' || b == 'n') { // the only valid value is 'NIL' index += 3; // skip past NIL
byte[] ba = null; if (!sc.isComplete()) { ba = r.readByteArray().getNewBytes(); if (ba.length > 0) ba = BASE64DecoderStream.decode(ba);
ba = new ByteArray(new byte[128], 0, 128); byte[] buffer = ba.getBytes(); int idx = 0; for (;;) { // read until CRLF with no preceeding literal if (incr > maxIncrement) incr = maxIncrement; ba.grow(incr); buffer = ba.getBytes(); if (count + incrementSlop > avail) { ba.grow(minIncrement > count + incrementSlop - avail ? minIncrement : count + incrementSlop - avail); buffer = ba.getBytes(); ba.setCount(idx); return ba;
/** * Read a new Response from the given Protocol * @param p the Protocol object */ 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(); }