001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018 package org.apache.commons.net.pop3; 019 020 /*** 021 * POP3MessageInfo is used to return information about messages stored on 022 * a POP3 server. Its fields are used to mean slightly different things 023 * depending on the information being returned. 024 * <p> 025 * In response to a status command, <code> number </code> 026 * contains the number of messages in the mailbox, <code> size </code> 027 * contains the size of the mailbox in bytes, and <code> identifier </code> 028 * is null. 029 * <p> 030 * In response to a message listings, <code> number </code> 031 * contains the message number, <code> size </code> contains the 032 * size of the message in bytes, and <code> identifier </code> is null. 033 * <p> 034 * In response to unique identifier listings, <code> number </code> contains 035 * the message number, <code> size </code> is undefined, and 036 * <code> identifier </code> contains the message's unique identifier. 037 * <p> 038 * <p> 039 * @author Daniel F. Savarese 040 ***/ 041 042 public final class POP3MessageInfo 043 { 044 // TODO - make these fields final? They are all set on construction 045 public int number; 046 public int size; 047 public String identifier; 048 049 /*** 050 * Creates a POP3MessageInfo instance with <code>number</code> and 051 * <code> size </code> set to 0, and <code>identifier</code> set to 052 * null. 053 ***/ 054 public POP3MessageInfo() 055 { 056 number = size = 0; 057 identifier = null; 058 } 059 060 /*** 061 * Creates a POP3MessageInfo instance with <code>number</code> set 062 * to <code> num </code>, <code> size </code> set to <code> octets </code>, 063 * and <code>identifier</code> set to null. 064 ***/ 065 public POP3MessageInfo(int num, int octets) 066 { 067 number = num; 068 size = octets; 069 identifier = null; 070 } 071 072 /*** 073 * Creates a POP3MessageInfo instance with <code>number</code> set 074 * to <code> num </code>, <code> size </code> undefined, 075 * and <code>identifier</code> set to <code>uid</code>. 076 ***/ 077 public POP3MessageInfo(int num, String uid) 078 { 079 number = num; 080 size = -1; 081 identifier = uid; 082 } 083 }