Package net.sourceforge.cardme.vcard.exceptions

Examples of net.sourceforge.cardme.vcard.exceptions.VCardBuildException


                  else {
                    b64str = Base64Wrapper.encode(photoBytes, Base64Wrapper.OPTIONS.NO_COMPRESSION);
                  }
                }
                catch(Exception ex) {
                  throw new VCardBuildException(ex.getMessage(), ex);
                }
               
                String tmpPhotoLine = tmpSb.toString();
                String foldedPhotoLine2 = VCardUtils.foldLine(tmpPhotoLine, eol, binaryFoldingScheme);
               
                foldedPhotoLine = VCardUtils.foldLine(b64str, eol, binaryFoldingScheme);
                sb.append(foldedPhotoLine2);        //Type declaration with param types
                sb.append(eol);                //Distinctive line break
                sb.append(binaryFoldingScheme.getIndent())//Indent first line
                break;
              }
             
              case RFC2426:
              case EVOLUTION:
              case KDE_ADDRESS_BOOK:
              case I_PHONE:
              default:
              {
                try {
                  byte[] photoBytes = photoType.getPhoto();
                  if(photoType.isCompressed()) {
                    tmpSb.append(Base64Wrapper.encode(photoBytes, Base64Wrapper.OPTIONS.GZIP_COMPRESSION));
                  }
                  else {
                    tmpSb.append(Base64Wrapper.encode(photoBytes, Base64Wrapper.OPTIONS.NO_COMPRESSION));
                  }
                }
                catch(Exception ex) {
                  throw new VCardBuildException(ex.getMessage(), ex);
                }
               
                String tmpPhotoLine = tmpSb.toString();
                foldedPhotoLine = VCardUtils.foldLine(tmpPhotoLine, eol, binaryFoldingScheme);
                break;
              }
            }
          }
          else {
            throw new VCardBuildException("PhotoType ("+VCardTypeName.PHOTO.getType()+") is not URI and not Inline, cannot proceed, must be one or the other.");
          }
         
          sb.append(foldedPhotoLine);
         
          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:
            default:
            {
              sb.append(eol);
              break;
            }
          }
        }
        else {
          throw new VCardBuildException("PhotoType ("+VCardTypeName.PHOTO.getType()+") exists but is empty.");
        }
      }
    }
    catch(Exception ex) {
      throw new VCardBuildException("PhotoType ("+VCardTypeName.PHOTO.getType()+") ["+ex.getClass().getName()+"] "+ex.getMessage(), ex);
    }
  }
View Full Code Here


                  else {
                    b64str = Base64Wrapper.encode(logoBytes, Base64Wrapper.OPTIONS.NO_COMPRESSION);
                  }
                }
                catch(Exception ex) {
                  throw new VCardBuildException(ex.getMessage(), ex);
                }
               
                String tmpLogoLine = tmpSb.toString();
                String foldedPhotoLine2 = VCardUtils.foldLine(tmpLogoLine, eol, binaryFoldingScheme);
               
                foldedLogoLine = VCardUtils.foldLine(b64str, binaryFoldingScheme);
                sb.append(foldedPhotoLine2);        //Type declaration with param types
                sb.append(eol);                //Distinctive line break
                sb.append(binaryFoldingScheme.getIndent())//Indent first line
                break;
              }
             
              case RFC2426:
              case EVOLUTION:
              case KDE_ADDRESS_BOOK:
              case I_PHONE:
              {
                try {
                  byte[] logoBytes = logoType.getLogo();
                  if(logoType.isCompressed()) {
                    tmpSb.append(Base64Wrapper.encode(logoBytes, Base64Wrapper.OPTIONS.GZIP_COMPRESSION));
                  }
                  else {
                    tmpSb.append(Base64Wrapper.encode(logoBytes, Base64Wrapper.OPTIONS.NO_COMPRESSION));
                  }
                }
                catch(Exception ex) {
                  throw new VCardBuildException(ex.getMessage(), ex);
                }
               
                String tmpLogoLine = tmpSb.toString();
                foldedLogoLine = VCardUtils.foldLine(tmpLogoLine, eol, binaryFoldingScheme);
                break;
              }
            }
          }
          else {
            throw new VCardBuildException("LogoType ("+VCardTypeName.LOGO.getType()+") is not URI and not Inline, cannot proceed, must be one or the other.");
          }
         
          sb.append(foldedLogoLine);

          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("LogoType ("+VCardTypeName.LOGO.getType()+") exists but is empty.");
        }
      }
    }
    catch(Exception ex) {
      throw new VCardBuildException("LogoType ("+VCardTypeName.LOGO.getType()+") ["+ex.getClass().getName()+"] "+ex.getMessage(), ex);
    }
  }
View Full Code Here

                  else {
                    b64str = Base64Wrapper.encode(soundBytes, Base64Wrapper.OPTIONS.NO_COMPRESSION);
                  }
                }
                catch(Exception ex) {
                  throw new VCardBuildException(ex.getMessage(), ex);
                }
               
                String tmpSoundLine = tmpSb.toString();
                String foldedSoundLine2 = VCardUtils.foldLine(tmpSoundLine, eol, binaryFoldingScheme);
               
                foldedSoundLine = VCardUtils.foldLine(b64str, eol, binaryFoldingScheme);
                sb.append(foldedSoundLine2);        //Type declaration with param types
                sb.append(eol);                //Distinctive line break
                sb.append(binaryFoldingScheme.getIndent())//Indent first line
                break;
              }
             
              case RFC2426:
              case EVOLUTION:
              case KDE_ADDRESS_BOOK:
              case I_PHONE:
              {
                try {
                  byte[] soundBytes = soundType.getSound();
                  if(soundType.isCompressed()) {
                    tmpSb.append(Base64Wrapper.encode(soundBytes, Base64Wrapper.OPTIONS.GZIP_COMPRESSION));
                  }
                  else {
                    tmpSb.append(Base64Wrapper.encode(soundBytes, Base64Wrapper.OPTIONS.NO_COMPRESSION));
                  }
                }
                catch(Exception ex) {
                  throw new VCardBuildException(ex.getMessage(), ex);
                }
               
                String tmpSoundLine = tmpSb.toString();
                foldedSoundLine = VCardUtils.foldLine(tmpSoundLine, eol, binaryFoldingScheme);
                break;
              }
            }
          }
          else {
            throw new VCardBuildException("SoundType ("+VCardTypeName.SOUND.getType()+") is not URI and not Inline, cannot proceed, must be one or the other.");
          }

          sb.append(foldedSoundLine);
         
          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("SoundType ("+VCardTypeName.SOUND.getType()+") exists but is empty.");
        }
      }
    }
    catch(Exception ex) {
      throw new VCardBuildException("SoundType ("+VCardTypeName.SOUND.getType()+") ["+ex.getClass().getName()+"] "+ex.getMessage(), ex);
    }
  }
View Full Code Here

              String agentVCardStr = writer.buildVCardString();
             
              tmpSb.append(VCardUtils.escapeString(agentVCardStr));
            }
            catch(VCardException ve) {
              throw new VCardBuildException(ve.getMessage(), ve);
            }
            catch(Exception ex) {
              throw new VCardBuildException(ex.getMessage(), ex);
            }
           
            String tmpAgentLine = tmpSb.toString();
            String foldedAgentLine = VCardUtils.foldLine(tmpAgentLine, eol, foldingScheme);
            sb.append(foldedAgentLine);
            sb.append(eol);
          }
          else {
            throw new VCardBuildException("AgentType ("+VCardTypeName.AGENT.getType()+") is not URI and not Inline, cannot proceed, must be one or the other.");
          }
        }
        else {
          throw new VCardBuildException("AgentType ("+VCardTypeName.AGENT.getType()+") exists but is empty.");
        }
      }
    }
    catch(Exception ex) {
      throw new VCardBuildException("AgentType ("+VCardTypeName.AGENT.getType()+") ["+ex.getClass().getName()+"] "+ex.getMessage(), ex);
    }
  }
View Full Code Here

          sb.append(foldedUrlLine);
         
          sb.append(eol);
        }
        else {
          throw new VCardBuildException("ImppType ("+VCardTypeName.IMPP.getType()+") exists but is empty.");
        }
      }
    }
    catch(Exception ex) {
      throw new VCardBuildException("ImppType ("+VCardTypeName.IMPP.getType()+") ["+ex.getClass().getName()+"] "+ex.getMessage(), ex);
    }
  }
View Full Code Here

       
        sb.append(foldedExtendedLine);
        sb.append(eol);
      }
      else {
        throw new VCardBuildException("ExtendedType is null.");
      }
    }
    catch(Exception ex) {
      throw new VCardBuildException("ExtendedType ("+VCardTypeName.XTENDED.getType()+") ["+ex.getClass().getName()+"] "+ex.getMessage(), ex);
    }
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.cardme.vcard.exceptions.VCardBuildException

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.