当前位置: 首页>>代码示例>>Java>>正文


Java Folder.HOLDS_FOLDERS属性代码示例

本文整理汇总了Java中javax.mail.Folder.HOLDS_FOLDERS属性的典型用法代码示例。如果您正苦于以下问题:Java Folder.HOLDS_FOLDERS属性的具体用法?Java Folder.HOLDS_FOLDERS怎么用?Java Folder.HOLDS_FOLDERS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.mail.Folder的用法示例。


在下文中一共展示了Folder.HOLDS_FOLDERS属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: receiveByFolder

public void receiveByFolder(Folder folder, JavamailConfig javamailConfig)
        throws MessagingException, IOException {
    logger.info("receive : {}", folder);

    if ((Folder.HOLDS_MESSAGES & folder.getType()) != 0) {
        this.receiveMessageByFolder(folder, javamailConfig);
    }

    if ((Folder.HOLDS_FOLDERS & folder.getType()) != 0) {
        for (Folder childFolder : folder.list()) {
            this.receiveByFolder(childFolder, javamailConfig);
        }
    }

    if (folder.isOpen()) {
        // 关闭资源
        folder.close(false);
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:19,代码来源:JavamailService.java

示例2: isLeaf

/**
    * a Folder is a leaf if it cannot contain sub folders
    */
   public boolean isLeaf() {
try {
    if ((folder.getType() & Folder.HOLDS_FOLDERS) == 0)
	return true;
} catch (MessagingException me) { }

// otherwise it does hold folders, and therefore not
// a leaf
return false;
   }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:13,代码来源:FolderTreeNode.java

示例3: main

public static void main(String[] argv) throws Exception {
    String fileName = MailConstants.PROPS_FILE_NAME;
    String protocol = null;
    String host = null;
    String user = null;
    String password = null;
    String root = null;

    // If argc == 1, assume it's a Properties file.
    if (argv.length == 1) {
        fileName = argv[0];
        FileProperties fp = new FileProperties(fileName);
        fp.load();
        protocol = fp.getProperty(MailConstants.RECV_PROTO);
        host = fp.getProperty(MailConstants.RECV_HOST);
        user = fp.getProperty(MailConstants.RECV_USER);
        password = fp.getProperty(MailConstants.RECV_PASS);
        root = fp.getProperty(MailConstants.RECV_ROOT);
    }
    // If not, assume listing all args in long form.
    else if (argv.length == 5) {
        protocol = argv[0];
        host = argv[1];
        user = argv[2];
        password = argv[3];
        root = argv[4];
    }
    // Otherwise give up.
    else {
        System.err.println(
            "Usage: MailLister protocol host user pw root");
        System.exit(0);
    }

    boolean recursive = false;

    // Start with a JavaMail Session object
    Session session = Session.getDefaultInstance(
        System.getProperties(), null);
    session.setDebug(false);

    // Get a Store object for the given protocol
    Store store = session.getStore(protocol);
    if (password.equals("*")) {
        final char[] passBytes = 
            System.console().readPassword("Password:", (Object[])null);
        password = new String(passBytes);
    }
    store.connect(host, user, password);

    // Get Folder object for root, and list it
    // If root name = "", getDefaultFolder(), else getFolder(root)
    Folder rf;
    if (root.length() != 0) {
        System.out.println("Getting folder " + root + ".");
        rf = store.getFolder(root);
    } else {
        System.out.println("Getting default folder.");
        rf = store.getDefaultFolder();
    }
    rf.open(Folder.READ_WRITE);

    if (rf.getType() == Folder.HOLDS_FOLDERS) {
        Folder[] fs = rf.list();
        for (Folder f : fs) {
            listFolder(f, "", recursive);
        }
    } else {
        listFolder(rf, "", false);
    }
}
 
开发者ID:shashanksingh28,项目名称:code-similarity,代码行数:71,代码来源:MailLister.java

示例4: listFolder

static void listFolder(Folder folder, String tab, boolean recurse)
throws Exception {
    folder.open(Folder.READ_WRITE);
    System.out.println(tab + "Name: " + folder.getName() + '(' +
        folder.getFullName() + ')');
    if (!folder.isSubscribed())
        System.out.println(tab + "Not Subscribed");
    if ((folder.getType() & Folder.HOLDS_MESSAGES) != 0) {
        if (folder.hasNewMessages())
            System.out.println(tab + "Has New Messages");
        else
            System.out.println(tab + "No New Messages");
        Message[] msgs = folder.getMessages();
        for (Message m : msgs) {
            Address from = m.getFrom()[0];
            String fromAddress;
            if (from instanceof InternetAddress)
                fromAddress = ((InternetAddress)from).getAddress();
            else
                fromAddress = from.toString();
            StringBuffer sb = new StringBuffer();
            fromFmt.format(fromAddress, sb, null);
            sb.    append("  ");
            subjFmt.format(m.getSubject(), sb, null);
            System.out.println(sb.toString());
        }
    }
    if ((folder.getType() & Folder.HOLDS_FOLDERS) != 0) {
        System.out.println(tab + "Is Directory");
    }
    if (recurse) {
        Folder[] fs = folder.list();
        for (Folder f : fs) {
            listFolder(f, tab + "", recurse);
        }
    }
}
 
开发者ID:shashanksingh28,项目名称:code-similarity,代码行数:37,代码来源:MailLister.java

示例5: FolderIterator

public FolderIterator(JavaxMailFolder folder) {
  this.folder = folder;
  logger.fine(() -> "Opening folder:" + folder.getName());
  if (!folder.isOpen()) {
    folder.open(Folder.READ_ONLY);
  }
  this.messageIterator = (folder.getType() & Folder.HOLDS_MESSAGES) > 0
      ? new MessageIterator()
      : Collections.emptyIterator();
  this.subfolderIterator = (folder.getType() & Folder.HOLDS_FOLDERS) > 0
      ? new SubfolderIterator()
      : Collections.emptyIterator();
}
 
开发者ID:google,项目名称:mail-importer,代码行数:13,代码来源:JavaxMailStorage.java

示例6: listFolder

public cfQueryResultData listFolder( cfImapConnection imapConnection, String rootFolder) throws cfmRunTimeException {
	
	cfQueryResultData query	= new cfQueryResultData( new String[]{"fullname","name","totalmessages","unread","new"},"CFIMAP" );						

	try{
	
		Folder	folderToList;

		if ( rootFolder == null || rootFolder.length() == 0 )
			folderToList = imapConnection.mailStore.getDefaultFolder();
		else
			folderToList = imapConnection.mailStore.getFolder(rootFolder);
			
		if ( (folderToList.getType() & Folder.HOLDS_FOLDERS) != 0){
			Folder[] folderArray = folderToList.list();
			
			query.addRow( folderArray.length );				
			
			for (int i = 0; i < folderArray.length; i++)
				folderRow( query, i+1, folderArray[i] );
		}

	}catch(Exception E){}
	
	return query;
}
 
开发者ID:OpenBD,项目名称:openbd-core,代码行数:26,代码来源:cfMailFolderData.java

示例7: listAllFolders

public cfQueryResultData listAllFolders( cfImapConnection imapConnection) throws cfmRunTimeException {
	cfQueryResultData query	= new cfQueryResultData( new String[]{"fullname","name","totalmessages","unread","new"},"CFIMAP" );						
	
	try{
		Folder	folderToList;
		folderToList = imapConnection.mailStore.getDefaultFolder();

		if ( (folderToList.getType() & Folder.HOLDS_FOLDERS) != 0){
			Folder[] folderArray = folderToList.list("*");
			query.addRow( folderArray.length );				
			
			for (int i = 0; i < folderArray.length; i++)
				folderRow( query, i+1, folderArray[i] );
		}

	}catch(Exception E){}
	
	return query;
}
 
开发者ID:OpenBD,项目名称:openbd-core,代码行数:19,代码来源:cfMailFolderData.java


注:本文中的javax.mail.Folder.HOLDS_FOLDERS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。