else {
b64str = Base64Wrapper.encode(keyBytes, Base64Wrapper.OPTIONS.NO_COMPRESSION);
}
}
catch(Exception ex) {
throw new VCardBuildException(ex.getMessage(), ex);
}
}
else {
b64str = new String(keyBytes);
}
String tmpKeyLine = tmpSb.toString();
String foldedKeyLine2 = VCardUtils.foldLine(tmpKeyLine, eol, binaryFoldingScheme);
foldedKeyLine = VCardUtils.foldLine(b64str, eol, binaryFoldingScheme);
sb.append(foldedKeyLine2); //Type declaration with param types
sb.append(eol); //Distinctive line break
sb.append(binaryFoldingScheme.getIndent()); //Indent first line
break;
}
case EVOLUTION:
case KDE_ADDRESS_BOOK:
case RFC2426:
case I_PHONE:
{
byte[] keyBytes = keyType.getKey();
if(binary) {
try {
if(keyType.isCompressed()) {
tmpSb.append(Base64Wrapper.encode(keyBytes, Base64Wrapper.OPTIONS.GZIP_COMPRESSION));
}
else {
tmpSb.append(Base64Wrapper.encode(keyBytes, Base64Wrapper.OPTIONS.NO_COMPRESSION));
}
}
catch(Exception ex) {
throw new VCardBuildException(ex.getMessage(), ex);
}
}
else {
tmpSb.append(new String(keyBytes));
}
String tmpKeyLine = tmpSb.toString();
foldedKeyLine = VCardUtils.foldLine(tmpKeyLine, eol, binaryFoldingScheme);
break;
}
}
sb.append(foldedKeyLine);
switch(compatMode)
{
case MS_OUTLOOK:
{
sb.append(eol);
sb.append(eol);
break;
}
case RFC2426:
case EVOLUTION:
case KDE_ADDRESS_BOOK:
case I_PHONE:
case MAC_ADDRESS_BOOK:
{
sb.append(eol);
break;
}
}
}
else {
throw new VCardBuildException("KeyType ("+VCardTypeName.KEY.getType()+") exists but is empty.");
}
}
}
catch(Exception ex) {
throw new VCardBuildException("KeyType ("+VCardTypeName.KEY.getType()+") ["+ex.getClass().getName()+"] "+ex.getMessage(), ex);
}
}