Results 1 to 7 of 7
  1. #1
    Hussain Ali is offline Member
    Join Date
    Feb 2010
    Posts
    37
    Rep Power
    0

    Default creating vCard file

    hii every one
    how can i make / create vCard file with java program
    plz tell fast
    its urgent

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    5

    Default

    I keep meaning to find a good API to do this.

    i was thinking of just following the specification vCard - Wikipedia, the free encyclopedia

    and doing
    PrintStream out ; // = System.out
    out.println("BEGIN:VCARD");
    out.println("VERSION:2.1");

    and then painfully for each field of my contact record doing an out.println() for each required header.

    I theorize I would make a bean with the standard properties a vcard record would have and load those up from my data source, or where ever i am pulling the contact details from, and override the toString() method to make it print out all this vcard details.

    But I haven't gotten around to doing this myself yet.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    travishein, as usual, thanks for your posts. I learn so much from them.

  4. #4
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    5

    Default

    I'm glad to help. I also find I learn things myself by posting, I like being challenged to think about things that are different from what I would ordinarily have to solve in my day.

  5. #5
    Hussain Ali is offline Member
    Join Date
    Feb 2010
    Posts
    37
    Rep Power
    0

    Default

    thans for help

  6. #6
    Hussain Ali is offline Member
    Join Date
    Feb 2010
    Posts
    37
    Rep Power
    0

    Default

    hello
    I m using this code to create vcf and keep record in that file
    Java Code:
    import java.io.*;
    
    public class VCARD{
    
        public static void main(String[] args) throws IOException{
    
          File f=new File("textfile1.vcf");
          FileOutputStream fop=new FileOutputStream(f);
    
          if(f.exists()){
          String str="BEGIN:VCARD\n" +
          		     "VERSION 2.1\n" +
          		     "N:Chetan\n" +
          		     "END:VCARD";
              fop.write(str.getBytes());
    
              fop.flush();
              fop.close();
              System.out.println("The data has been written");
              }
    
              else
                System.out.println("This file is not exist");
        }
      }
    it creates textfile.vcf but it cant contain the records


    and


    can explain me how can i put/insert record by using System.out.println()
    in to that vcf file

  7. #7
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    @OP, what happened to the link I gave you in your previous post about this problem?

Similar Threads

  1. making a vCard file
    By Hussain Ali in forum Advanced Java
    Replies: 2
    Last Post: 02-24-2010, 04:22 AM
  2. Creating an XML file with XML DOM
    By b1l0s in forum Advanced Java
    Replies: 0
    Last Post: 02-12-2010, 05:17 AM
  3. creating a file
    By aruna.hcu in forum New To Java
    Replies: 25
    Last Post: 01-06-2010, 06:15 PM
  4. Creating a .jar file
    By Wataru in forum New To Java
    Replies: 3
    Last Post: 07-22-2009, 06:02 AM
  5. creating .ear file
    By psn in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 01-06-2008, 05:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •