    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
    018package org.apache.commons.net.pop3;
    019
    020/**
    021 * POP3MessageInfo is used to return information about messages stored on a POP3 server. Its fields are used to mean slightly different things depending on the
    022 * information being returned.
    023 * <p>
    024 * In response to a status command, <code> number </code> contains the number of messages in the mailbox, <code> size </code> contains the size of the mailbox
    025 * in bytes, and <code> identifier </code> is null.
    026 * <p>
    027 * In response to a message listings, <code> number </code> contains the message number, <code> size </code> contains the size of the message in bytes, and
    028 * <code> identifier </code> is null.
    029 * <p>
    030 * In response to unique identifier listings, <code> number </code> contains the message number, <code> size </code> is undefined, and <code> identifier </code>
    031 * contains the message's unique identifier.
    032 *
    033 *
    034 */
    035
    036public final class POP3MessageInfo {
    037    public int number;
    038    public int size;
    039    public String identifier;
    040
    041    /**
    042     * Creates a POP3MessageInfo instance with <code>number</code> and <code> size </code> set to 0, and <code>identifier</code> set to null.
    043     */
    044    public POP3MessageInfo() {
    045        this(0, null, 0);
    046    }
    047
    048    /**
    049     * Creates a POP3MessageInfo instance with <code>number</code> set to <code> num </code>, <code> size </code> set to <code> octets </code>, and
    050     * <code>identifier</code> set to null.
    051     *
    052     * @param num    the number
    053     * @param octets the size
    054     */
    055    public POP3MessageInfo(final int num, final int octets) {
    056        this(num, null, octets);
    057    }
    058
    059    /**
    060     * Creates a POP3MessageInfo instance with <code>number</code> set to <code> num </code>, <code> size </code> undefined, and <code>identifier</code> set to
    061     * <code>uid</code>.
    062     *
    063     * @param num the number
    064     * @param uid the UID
    065     */
    066    public POP3MessageInfo(final int num, final String uid) {
    067        this(num, uid, -1);
    068    }
    069
    070    private POP3MessageInfo(final int num, final String uid, final int size) {
    071        this.number = num;
    072        this.size = size;
    073        this.identifier = uid;
    074    }
    075
    076    /**
    077     * @since 3.6
    078     */
    079    @Override
    080    public String toString() {
    081        return "Number: " + number + ". Size: " + size + ". Id: " + identifier;
    082    }
    083}