MCPcopy Create free account
hub / github.com/M66B/FairEmail / getSizes

Method getSizes

app/src/main/java/com/sun/mail/pop3/POP3Folder.java:495–527  ·  view source on GitHub ↗

Return the sizes of all messages in this folder, as returned by the POP3 LIST command. Each entry in the array corresponds to a message; entry i corresponds to message number i+1 . @return array of message sizes @exception IllegalStateException if the folder isn't open @exception Mes

()

Source from the content-addressed store, hash-verified

493 * @since JavaMail 1.3.3
494 */
495 public synchronized int[] getSizes() throws MessagingException {
496 checkOpen();
497 int sizes[] = new int[total];
498 InputStream is = null;
499 LineInputStream lis = null;
500 try {
501 is = port.list();
502 lis = new LineInputStream(is);
503 String line;
504 while ((line = lis.readLine()) != null) {
505 try {
506 StringTokenizer st = new StringTokenizer(line);
507 int msgnum = Integer.parseInt(st.nextToken());
508 int size = Integer.parseInt(st.nextToken());
509 if (msgnum > 0 && msgnum <= total)
510 sizes[msgnum - 1] = size;
511 } catch (RuntimeException e) {
512 }
513 }
514 } catch (IOException ex) {
515 // ignore it?
516 } finally {
517 try {
518 if (lis != null)
519 lis.close();
520 } catch (IOException cex) { }
521 try {
522 if (is != null)
523 is.close();
524 } catch (IOException cex) { }
525 }
526 return sizes;
527 }
528
529 /**
530 * Return the raw results of the POP3 LIST command with no arguments.

Callers

nothing calls this directly

Calls 6

checkOpenMethod · 0.95
readLineMethod · 0.95
listMethod · 0.45
parseIntMethod · 0.45
nextTokenMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected