checkSeen(); b = p.fetchBody(seqnum, section, pos, cnt, readbuf); } catch (ProtocolException pex) { forceCheckExpunged(); throw new IOException(pex.getMessage()); } catch (FolderClosedException fex) { forceCheckExpunged(); throw new IOException("No content"); checkSeen();
/** * Reads the next byte of data from this buffered input stream. * If no byte is available, the value <code>-1</code> is returned. */ public synchronized int read() throws IOException { if (bufpos >= bufcount) { fill(); if (bufpos >= bufcount) return -1; // EOF } return buf[bufpos++] & 0xff; }
/** * Reads up to <code>b.length</code> bytes of data from this input * stream into an array of bytes. <p> * * Returns the total number of bytes read into the buffer, or * <code>-1</code> is there is no more data. <p> * * Note that this method mimics the "weird !" semantics of * BufferedInputStream in that the number of bytes actually * returned may be less that the requested value. So callers * of this routine should be aware of this and must check * the return value to insure that they have obtained the * requisite number of bytes. */ public int read(byte b[]) throws IOException { return read(b, 0, b.length); }
return new IMAPInputStream(message, sectionId, message.ignoreBodyStructureSize() ? -1 : bs.size, pk);
return new IMAPInputStream(message, sectionId, message.ignoreBodyStructureSize() ? -1 : bs.size, pk);
checkSeen(); b = p.fetchBody(seqnum, section, pos, cnt, readbuf); } catch (ProtocolException pex) { forceCheckExpunged(); throw new IOException(pex.getMessage()); } catch (FolderClosedException fex) { forceCheckExpunged(); checkSeen();
return new IMAPInputStream(this, sectionId, -1, pk);
/** * Reads the next byte of data from this buffered input stream. * If no byte is available, the value <code>-1</code> is returned. */ @Override public synchronized int read() throws IOException { if (bufpos >= bufcount) { fill(); if (bufpos >= bufcount) return -1; // EOF } return buf[bufpos++] & 0xff; }
/** * Reads up to <code>b.length</code> bytes of data from this input * stream into an array of bytes. <p> * * Returns the total number of bytes read into the buffer, or * <code>-1</code> is there is no more data. <p> * * Note that this method mimics the "weird !" semantics of * BufferedInputStream in that the number of bytes actually * returned may be less that the requested value. So callers * of this routine should be aware of this and must check * the return value to insure that they have obtained the * requisite number of bytes. */ @Override public int read(byte b[]) throws IOException { return read(b, 0, b.length); }
checkSeen(); b = p.fetchBody(seqnum, section, pos, cnt, readbuf); } catch (ProtocolException pex) { forceCheckExpunged(); throw new IOException(pex.getMessage()); } catch (FolderClosedException fex) { forceCheckExpunged(); throw new IOException("No content"); checkSeen();
return new IMAPInputStream(this, toSection("TEXT"), bs != null && !ignoreBodyStructureSize() ? bs.size : -1, pk);
/** * Reads up to <code>len</code> bytes of data from this * input stream into the given buffer. <p> * * Returns the total number of bytes read into the buffer, * or <code>-1</code> if there is no more data. <p> * * Note that this method mimics the "weird !" semantics of * BufferedInputStream in that the number of bytes actually * returned may be less that the requested value. So callers * of this routine should be aware of this and must check * the return value to insure that they have obtained the * requisite number of bytes. */ public synchronized int read(byte b[], int off, int len) throws IOException { int avail = bufcount - bufpos; if (avail <= 0) { fill(); avail = bufcount - bufpos; if (avail <= 0) return -1; // EOF } int cnt = (avail < len) ? avail : len; System.arraycopy(buf, bufpos, b, off, cnt); bufpos += cnt; return cnt; }
/** * Reads up to <code>b.length</code> bytes of data from this input * stream into an array of bytes. <p> * * Returns the total number of bytes read into the buffer, or * <code>-1</code> is there is no more data. <p> * * Note that this method mimics the "weird !" semantics of * BufferedInputStream in that the number of bytes actually * returned may be less that the requested value. So callers * of this routine should be aware of this and must check * the return value to insure that they have obtained the * requisite number of bytes. */ @Override public int read(byte b[]) throws IOException { return read(b, 0, b.length); }
checkSeen(); b = p.fetchBody(seqnum, section, pos, cnt, readbuf); } catch (ProtocolException pex) { forceCheckExpunged(); throw new IOException(pex.getMessage()); } catch (FolderClosedException fex) { forceCheckExpunged(); throw new IOException("No content"); checkSeen();
return new IMAPInputStream(this, sectionId, -1, pk);
/** * Reads up to <code>len</code> bytes of data from this * input stream into the given buffer. <p> * * Returns the total number of bytes read into the buffer, * or <code>-1</code> if there is no more data. <p> * * Note that this method mimics the "weird !" semantics of * BufferedInputStream in that the number of bytes actually * returned may be less that the requested value. So callers * of this routine should be aware of this and must check * the return value to insure that they have obtained the * requisite number of bytes. */ @Override public synchronized int read(byte b[], int off, int len) throws IOException { int avail = bufcount - bufpos; if (avail <= 0) { fill(); avail = bufcount - bufpos; if (avail <= 0) return -1; // EOF } int cnt = (avail < len) ? avail : len; System.arraycopy(buf, bufpos, b, off, cnt); bufpos += cnt; return cnt; }
/** * Reads up to <code>b.length</code> bytes of data from this input * stream into an array of bytes. <p> * * Returns the total number of bytes read into the buffer, or * <code>-1</code> is there is no more data. <p> * * Note that this method mimics the "weird !" semantics of * BufferedInputStream in that the number of bytes actually * returned may be less that the requested value. So callers * of this routine should be aware of this and must check * the return value to insure that they have obtained the * requisite number of bytes. */ public int read(byte b[]) throws IOException { return read(b, 0, b.length); }
checkSeen(); b = p.fetchBody(seqnum, section, pos, cnt, readbuf); } catch (ProtocolException pex) { forceCheckExpunged(); throw new IOException(pex.getMessage()); } catch (FolderClosedException fex) { forceCheckExpunged(); checkSeen();
protected InputStream getContentStream() throws MessagingException { InputStream is = null; boolean pk = message.getPeek(); // acquire outisde of message cache lock // Acquire MessageCacheLock, to freeze seqnum. synchronized(message.getMessageCacheLock()) { try { IMAPProtocol p = message.getProtocol(); // Check whether this message is expunged message.checkExpunged(); if (p.isREV1() && (message.getFetchBlockSize() != -1)) return new IMAPInputStream(message, sectionId, bs.size, pk); // Else, vanila IMAP4, no partial fetch int seqnum = message.getSequenceNumber(); BODY b; if (pk) b = p.peekBody(seqnum, sectionId); else b = p.fetchBody(seqnum, sectionId); if (b != null) is = b.getByteArrayInputStream(); } catch (ConnectionException cex) { throw new FolderClosedException( message.getFolder(), cex.getMessage()); } catch (ProtocolException pex) { throw new MessagingException(pex.getMessage(), pex); }
/** * Reads the next byte of data from this buffered input stream. * If no byte is available, the value <code>-1</code> is returned. */ public synchronized int read() throws IOException { if (bufpos >= bufcount) { fill(); if (bufpos >= bufcount) return -1; // EOF } return buf[bufpos++] & 0xff; }