Examples of DistributedDatabaseException


Examples of org.gudy.azureus2.plugins.ddb.DistributedDatabaseException

    DistributedDatabaseKey        key,
    DistributedDatabaseValue      data )
 
    throws DistributedDatabaseException
  {
    throw( new DistributedDatabaseException( "not implemented" ));
  }
View Full Code Here

Examples of org.gudy.azureus2.plugins.ddb.DistributedDatabaseException

  {
    byte[]  res;
   
    if ( obj == null ){
     
      throw( new DistributedDatabaseException( "null not supported" ));
     
    }else if ( obj instanceof byte[] ){
     
      res = (byte[])obj;
     
    }else if ( obj instanceof String ){
     
      try{
        res = ((String)obj).getBytes("UTF-8");
     
      }catch( UnsupportedEncodingException e ){
       
        throw( new DistributedDatabaseException( "charset error", e ));
      }
    }else if obj instanceof Byte ||
          obj instanceof Short ||
          obj instanceof Integer ||
          obj instanceof Long ||
          obj instanceof Float ||
          obj instanceof Double ||
          obj instanceof Boolean ){
     
      throw( new DistributedDatabaseException( "not supported yet!" ));
         
    }else{
     
      try{
        ByteArrayOutputStream  baos = new ByteArrayOutputStream();
       
        ObjectOutputStream  oos = new ObjectOutputStream( baos );
       
        oos.writeObject( obj );
       
        oos.close();
       
        res = baos.toByteArray();
       
      }catch( Throwable e ){
       
        throw( new DistributedDatabaseException( "encoding fails", e ));
      }
    }
   
    return( res );
  }
View Full Code Here

Examples of org.gudy.azureus2.plugins.ddb.DistributedDatabaseException

       
        return( new String( data, "UTF-8" ));
       
      }catch( UnsupportedEncodingException e ){
       
        throw( new DistributedDatabaseException( "charset error", e ));
      }
    }else{
     
      try{
        ObjectInputStream  iis = new ObjectInputStream( new ByteArrayInputStream( data ));
       
        Object  res = iis.readObject();
       
        if ( target.isInstance( res )){
         
          return( res );
         
        }else{
         
          throw( new DistributedDatabaseException( "decoding fails, incompatible type" ));
        }

      }catch( DistributedDatabaseException e ){
       
        throw( e );
       
      }catch( Throwable e ){
       
        throw( new DistributedDatabaseException( "decoding fails", e ));
      }   
    }
  }
View Full Code Here

Examples of org.gudy.azureus2.plugins.ddb.DistributedDatabaseException

  {
    String  name = c.getName();
   
    if ( name == null ){
     
      throw( new DistributedDatabaseException( "name doesn't exist for '" + c.getName() + "'" ));
    }
     
    return( new HashWrapper(new SHA1Simple().calculateHash(name.getBytes())));
  }
View Full Code Here

Examples of org.gudy.azureus2.plugins.ddb.DistributedDatabaseException

    DistributedDatabaseKey        key,
    DistributedDatabaseValue      value )
 
    throws DistributedDatabaseException
  {
    throw( new DistributedDatabaseException( "not supported" ));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.