Package net.sourceforge.cardme.vcard.types

Examples of net.sourceforge.cardme.vcard.types.VersionType


   
    /* This string will work just fine as the fold is in the middle of a word */
    final String correctNote = "Lines seem to be unfolded correctly if spaces aren't exactly on a folding boundary.";
   
    VCard vcard = new VCardImpl();
    vcard.setVersion(new VersionType(VCardVersion.V3_0));
    vcard.setName(new NameType("Some Name"));
    vcard.addNote(new NoteType(correctNote));

    VCardWriter writer = new VCardWriter();
    writer.setVCard(vcard);
    String vcardString = writer.buildVCardString();
   
    VCardEngine vcardEngine = new VCardEngine(CompatibilityMode.RFC2426);
    VCard parsedVcard = vcardEngine.parse(vcardString);
   
    assertNotNull(parsedVcard);
    assertTrue(parsedVcard.hasNotes());
    assertTrue(parsedVcard.getNotes().size() == 1);

    String parsedNote = parsedVcard.getNotes().get(0).getNote();
    assertEquals(correctNote, parsedNote);
   
    //------------------------------------------------------
   
    /* This string has the fold right at a space and the space is lost when retrieving it later */
    final String incorrectNote = "Lines seem to be unfolded incorrectly if spaces are just exactly on a folding boundary.";
   
    vcard = new VCardImpl();
    vcard.setVersion(new VersionType(VCardVersion.V3_0));
    vcard.setName(new NameType("Some Name"));
    vcard.addNote(new NoteType(incorrectNote));

    writer = new VCardWriter();
    writer.setVCard(vcard);
View Full Code Here


  }
 
  private static VCardImpl getFullVCardNoErrors() throws IOException, URISyntaxException
  {
    VCardImpl vcard = new VCardImpl();
    vcard.setVersion(new VersionType(VCardVersion.V3_0));
   
    NameType name = new NameType();
    name.setName("VCard for John Doe");
    vcard.setName(name);
   
View Full Code Here

  }
 
  @Test
  public void testBuildVersionType() throws VCardBuildException {
    VCardImpl vcard = getSimpleVCard();
    vcard.setVersion(new VersionType(VCardVersion.V3_0));
   
    VCardWriter vcardWriter = new VCardWriter();
    vcardWriter.setOutputVersion(VCardVersion.V3_0);
    vcardWriter.setCompatibilityMode(CompatibilityMode.RFC2426);
    vcardWriter.setFoldingScheme(FoldingScheme.MIME_DIR);
View Full Code Here

  }
 
  private VCardImpl getSimpleVCard()
  {
    VCardImpl vcard = new VCardImpl();
    vcard.setVersion(new VersionType(VCardVersion.V3_0));
    vcard.setN(new NType("Doe", "John"));
    vcard.setFN(new FNType("John \"Johny\" Doe"));
    return vcard;
  }
View Full Code Here

  }
 
  @Test
  public void testForceEncodeQuotedPrintableSpaces_1() throws VCardBuildException {
    VCardImpl vcard = new VCardImpl();
    vcard.setVersion(new VersionType(VCardVersion.V3_0));
    vcard.setN(new NType("Doe", "John"));
    vcard.setFN(new FNType("John Doe"));
   
    NoteType note = new NoteType("This is a note with normal text.");
    note.setEncodingType(EncodingType.QUOTED_PRINTABLE);
View Full Code Here

  }
 
  @Test
  public void testForceEncodeQuotedPrintableSpaces_2() throws VCardBuildException {
    VCardImpl vcard = new VCardImpl();
    vcard.setVersion(new VersionType(VCardVersion.V3_0));
    vcard.setN(new NType("Doe", "John"));
    vcard.setFN(new FNType("John Doe"));
   
    NoteType note = new NoteType("This is a note with normal text.");
    note.setEncodingType(EncodingType.QUOTED_PRINTABLE);
View Full Code Here

  }
 
  @Test
  public void testForceEncodeQuotedPrintableSpaces_3() throws VCardBuildException {
    VCardImpl vcard = new VCardImpl();
    vcard.setVersion(new VersionType(VCardVersion.V3_0));
    vcard.setN(new NType("Doe", "John"));
    vcard.setFN(new FNType("John Doe"));
   
    NoteType note = new NoteType("新中西里杨阿姨 some spaces ");
    note.setEncodingType(EncodingType.QUOTED_PRINTABLE);
View Full Code Here

  }
 
  @Test
  public void testForceEncodeQuotedPrintableSpaces_4() throws VCardBuildException {
    VCardImpl vcard = new VCardImpl();
    vcard.setVersion(new VersionType(VCardVersion.V3_0));
    vcard.setN(new NType("Doe", "John"));
    vcard.setFN(new FNType("John Doe"));
   
    NoteType note = new NoteType("新中西里杨阿姨 some spaces ");
    note.setEncodingType(EncodingType.QUOTED_PRINTABLE);
View Full Code Here

  private ErrorSeverity errorSeverity = ErrorSeverity.NONE;
  private boolean throwsExceptions = false;
 
  public VCardImpl() {
    setBegin(new BeginType());
    setVersion(new VersionType(VCardVersion.V3_0));
    setEnd(new EndType());
  }
View Full Code Here

    setEnd(new EndType());
  }
 
  public VCardImpl(NType n, FNType fn) {
    setBegin(new BeginType());
    setVersion(new VersionType(VCardVersion.V3_0));
    setN(n);
    setFN(fn);
    setEnd(new EndType());
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.cardme.vcard.types.VersionType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.