javax.mail.Message.getFlags()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(202)

本文整理了Java中javax.mail.Message.getFlags()方法的一些代码示例,展示了Message.getFlags()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getFlags()方法的具体详情如下:
包路径:javax.mail.Message
类名称:Message
方法名:getFlags

Message.getFlags介绍

[英]Returns a Flags object containing the flags for this message.

Modifying any of the flags in this returned Flags object will not affect the flags of this message. Use setFlags() to do that.
[中]

代码示例

代码示例来源:origin: com.sun.mail/javax.mail

/**
 * Check whether the flag specified in the <code>flag</code>
 * argument is set in this message. <p>
 *
 * The default implementation uses <code>getFlags</code>.
 *
 * @param flag    the flag
 * @return        value of the specified flag for this message
 * @see         javax.mail.Flags.Flag
 * @see        javax.mail.Flags.Flag#ANSWERED
 * @see        javax.mail.Flags.Flag#DELETED
 * @see        javax.mail.Flags.Flag#DRAFT
 * @see        javax.mail.Flags.Flag#FLAGGED
 * @see        javax.mail.Flags.Flag#RECENT
 * @see        javax.mail.Flags.Flag#SEEN
 * @exception       MessagingException for failures
 */
public boolean isSet(Flags.Flag flag) throws MessagingException {
return getFlags().contains(flag);
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Check whether the flag specified in the <code>flag</code>
 * argument is set in this message. <p>
 *
 * The default implementation uses <code>getFlags</code>.
 *
 * @param flag    the flag
 * @return        value of the specified flag for this message
 * @see         javax.mail.Flags.Flag
 * @see        javax.mail.Flags.Flag#ANSWERED
 * @see        javax.mail.Flags.Flag#DELETED
 * @see        javax.mail.Flags.Flag#DRAFT
 * @see        javax.mail.Flags.Flag#FLAGGED
 * @see        javax.mail.Flags.Flag#RECENT
 * @see        javax.mail.Flags.Flag#SEEN
 * @exception       MessagingException for failures
 */
public boolean isSet(Flags.Flag flag) throws MessagingException {
return getFlags().contains(flag);
}

代码示例来源:origin: oblac/jodd

flags(msg.getFlags());

代码示例来源:origin: camunda/camunda-bpm-platform

Flags f = msg.getFlags();
if (set) { // This is easy
if (f.contains(flags))

代码示例来源:origin: com.sun.mail/javax.mail

Flags f = msg.getFlags();
if (set) { // This is easy
if (f.contains(flags))

代码示例来源:origin: com.sun.mail/javax.mail

d = m.getSentDate();
final Date dd = d;
final Flags f = m.getFlags();

代码示例来源:origin: camunda/camunda-bpm-platform

d = m.getSentDate();
final Date dd = d;
final Flags f = m.getFlags();

代码示例来源:origin: camunda/camunda-bpm-platform

d = m.getSentDate();
final Date dd = d;
final Flags f = m.getFlags();
AppendUID auid = (AppendUID)doCommand(new ProtocolCommand() {
public Object doCommand(IMAPProtocol p)

代码示例来源:origin: com.sun.mail/javax.mail

d = m.getSentDate();
final Date dd = d;
final Flags f = m.getFlags();
AppendUID auid = (AppendUID)doCommand(new ProtocolCommand() {
@Override

代码示例来源:origin: stackoverflow.com

public Message[] getUnreadMessages() {
  Message[] messages = inbox.getMessages(1, messageCount);
  List<Message> readMessages = new ArrayList<Message>();
  for (Message message : messages) {
    boolean isMessageRead = false;
    for (Flags.Flag flag : message.getFlags().getSystemFlags()) {
      if (flag == Flags.Flag.SEEN) {
        readMessages.add(message);
        break;
      }
    }
  List<Message> unread = Arrays.asList(messages).removeAll(readMessagess); 
  return unread .toArray(new Message[unread.size()]);
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec

/**
 * Check whether the supplied flag is set.
 * The default implementation checks the flags returned by {@link #getFlags()}.
 *
 * @param flag the flags to check for
 * @return true if the flags is set
 * @throws MessagingException if there was a problem accessing the Store
 */
public boolean isSet(Flags.Flag flag) throws MessagingException {
  return getFlags().contains(flag);
}

代码示例来源:origin: google/mail-importer

@Override
public Flags getFlags() throws RuntimeMessagingException {
 try {
  return delegate.getFlags();
 } catch (MessagingException e) {
  throw new RuntimeMessagingException(e);
 }
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec

/**
 * Check whether the supplied flag is set.
 * The default implementation checks the flags returned by {@link #getFlags()}.
 *
 * @param flag the flags to check for
 * @return true if the flags is set
 * @throws MessagingException if there was a problem accessing the store
 */
public boolean isSet(Flags.Flag flag) throws MessagingException {
  return getFlags().contains(flag);
}

代码示例来源:origin: org.jvnet.mock-javamail/mock-javamail

public Message[] expunge() throws MessagingException {
    List<Message> expunged = new ArrayList<Message>();
    for (Message msg : mailbox) {
      if(msg.getFlags().contains(Flag.DELETED))
        expunged.add(msg);
    }
    mailbox.removeAll(expunged);
    return expunged.toArray(new Message[expunged.size()]);
  }
}

代码示例来源:origin: javax.mail/javax.mail-api

/**
 * Check whether the flag specified in the <code>flag</code>
 * argument is set in this message. <p>
 *
 * The default implementation uses <code>getFlags</code>.
 *
 * @param flag    the flag
 * @return        value of the specified flag for this message
 * @see         javax.mail.Flags.Flag
 * @see        javax.mail.Flags.Flag#ANSWERED
 * @see        javax.mail.Flags.Flag#DELETED
 * @see        javax.mail.Flags.Flag#DRAFT
 * @see        javax.mail.Flags.Flag#FLAGGED
 * @see        javax.mail.Flags.Flag#RECENT
 * @see        javax.mail.Flags.Flag#SEEN
 * @exception       MessagingException for failures
 */
public boolean isSet(Flags.Flag flag) throws MessagingException {
return getFlags().contains(flag);
}

代码示例来源:origin: com.sun.mail/mailapi

/**
 * Check whether the flag specified in the <code>flag</code>
 * argument is set in this message. <p>
 *
 * The default implementation uses <code>getFlags</code>.
 *
 * @param flag    the flag
 * @return        value of the specified flag for this message
 * @see         javax.mail.Flags.Flag
 * @see        javax.mail.Flags.Flag#ANSWERED
 * @see        javax.mail.Flags.Flag#DELETED
 * @see        javax.mail.Flags.Flag#DRAFT
 * @see        javax.mail.Flags.Flag#FLAGGED
 * @see        javax.mail.Flags.Flag#RECENT
 * @see        javax.mail.Flags.Flag#SEEN
 * @exception       MessagingException for failures
 */
public boolean isSet(Flags.Flag flag) throws MessagingException {
return getFlags().contains(flag);
}

代码示例来源:origin: javax.mail/com.springsource.javax.mail

/**
 * Check whether the flag specified in the <code>flag</code>
 * argument is set in this message. <p>
 *
 * The default implementation uses <code>getFlags</code>.
 *
 * @param flag    the flag
 * @return        value of the specified flag for this message
 * @see         javax.mail.Flags.Flag
 * @see        javax.mail.Flags.Flag#ANSWERED
 * @see        javax.mail.Flags.Flag#DELETED
 * @see        javax.mail.Flags.Flag#DRAFT
 * @see        javax.mail.Flags.Flag#FLAGGED
 * @see        javax.mail.Flags.Flag#RECENT
 * @see        javax.mail.Flags.Flag#SEEN
 * @exception       MessagingException
 */
public boolean isSet(Flags.Flag flag) throws MessagingException {
return getFlags().contains(flag);
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec

private int getCount(Flag flag, boolean value) throws MessagingException {
  if (!isOpen()) {
    return -1;
  }
  Message[] messages = getMessages();
  int total = 0;
  for (int i = 0; i < messages.length; i++) {
    if (messages[i].getFlags().contains(flag) == value) {
      total++;
    }
  }
  return total;
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec

private int getCount(Flag flag, boolean value) throws MessagingException {
  if (!isOpen()) {
    return -1;
  }
  Message[] messages = getMessages();
  int total = 0;
  for (int i = 0; i < messages.length; i++) {
    if (messages[i].getFlags().contains(flag) == value) {
      total++;
    }
  }
  return total;
}

代码示例来源:origin: org.mnode.mstor/mstor

/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
public final void appendMessages(Message[] messages) throws MessagingException {
  try {
    Date received = new Date();
    for (Message message : messages) {
      T md = getMessage(message.getMessageNumber());
      md.setReceived(received);
      md.setFlags(message.getFlags());
      md.setHeaders(message.getAllHeaders());
      allocateUid(md);
    }
    delegate.appendMessages(messages);
    save();
  }
  catch (DelegateException de) {
    throw new MessagingException("Error saving changes", de);
  }
}

相关文章