/android/export-contacts

To get this branch, use:
bzr branch http://bzr.ed.am/android/export-contacts

« back to all changes in this revision

Viewing changes to src/am/ed/exportcontacts/VcardExporter.java

  • Committer: Tim Marston
  • Date: 2013-07-16 16:24:59 UTC
  • Revision ID: tim@ed.am-20130716162459-u5z1iogael46ukp3
separate vcards with a newline

Show diffs side-by-side

added added

removed removed

1
1
/*
2
2
 * Exporter.java
3
3
 *
4
 
 * Copyright (C) 2011 to 2012 Tim Marston <tim@ed.am>
 
4
 * Copyright (C) 2011 to 2013 Tim Marston <tim@ed.am>
5
5
 *
6
6
 * This file is part of the Export Contacts program (hereafter referred
7
7
 * to as "this program").  For more information, see
36
36
public class VcardExporter extends Exporter
37
37
{
38
38
        protected FileOutputStream _ostream = null;
 
39
        protected boolean _first_contact = true;
39
40
 
40
41
        public VcardExporter( Doit doit )
41
42
        {
163
164
                return buffer.toString();
164
165
        }
165
166
 
166
 
 
167
167
        @Override
168
168
        protected boolean exportContact( ContactData contact )
169
169
                throws AbortExportException
174
174
                if( contact.getPrimaryIdentifier() == null )
175
175
                        return false;
176
176
 
 
177
                // append newline
 
178
                if( _first_contact )
 
179
                        _first_contact = false;
 
180
                else
 
181
                        out.append( "\n" );
 
182
 
177
183
                // append header
178
184
                out.append( "BEGIN:VCARD\n" );
179
185
                out.append( "VERSION:3.0\n" );