/** * Get the hash of the supplied content, using the supplied digest algorithm. * * @param algorithm the hashing function algorithm that should be used * @param content the content to be hashed; may not be null * @return the hash of the contents as a byte array * @throws NoSuchAlgorithmException if the supplied algorithm could not be found * @throws IllegalArgumentException if the algorithm is null */ public static byte[] getHash( Algorithm algorithm, byte[] content ) throws NoSuchAlgorithmException { CheckArg.isNotNull(algorithm, "algorithm"); return getHash(algorithm.digestName(), content); }
/** * @param name the model name (cannot be <code>null</code> or empty) * @param type the model type (can be <code>null</code> or empty) * @param pathInVdb the model path (can be <code>null</code> or empty) */ public VdbModel( String name, String type, String pathInVdb ) { CheckArg.isNotEmpty(name, "name"); this.name = name; this.pathInVdb = pathInVdb; this.type = (StringUtil.isBlank(type) ? CoreLexicon.ModelType.PHYSICAL : type); }
public DelegatingClassLoader( ClassLoader parent, Iterable<? extends ClassLoader> delegates ) { super(new URL[0], parent); CheckArg.isNotNull(delegates, "delegates"); this.delegates = delegates; }
/** * Create an InputStream instance that wraps another stream and that computes the secure hash (using the algorithm with the * supplied name) as the returned stream is used. This can be used to compute the hash of a stream while the stream is being * processed by another reader, and saves from having to process the same stream twice. * * @param algorithm the hashing function algorithm that should be used * @param inputStream the stream containing the content that is to be hashed * @return the hash of the contents as a byte array * @throws NoSuchAlgorithmException */ public static HashingInputStream createHashingStream( Algorithm algorithm, InputStream inputStream ) throws NoSuchAlgorithmException { return createHashingStream(algorithm.digestName(), inputStream); }
/** * Get the string representation of the binary hash of the content read by this reader. This method will return null if * the reader has not yet been closed. * * @return the hex-encoded representation of the binary hash of the contents, or null if the reader has not yet been * closed */ public String getHashAsHexString() { return SecureHash.asHexString(hash); } }
/** * Suspends encoding of the stream. May be helpful if you need to embed a piece of base64-encoded data in a stream. * * @throws java.io.IOException if there's an error flushing * @since 1.5.1 */ public void suspendEncoding() throws java.io.IOException { flushBase64(); this.suspendEncoding = true; } // end suspendEncoding
public Comparison( DynamicOperand operand1, Operator operator, StaticOperand operand2 ) { CheckArg.isNotNull(operand1, "operand1"); CheckArg.isNotNull(operator, "operator"); CheckArg.isNotNull(operand2, "operand2"); this.operand1 = operand1; this.operand2 = operand2; this.operator = operator; this.hc = HashCode.compute(this.operand1, this.operand2, this.operator); }
/** * Get the hash of the supplied content, using the supplied digest algorithm. * * @param algorithm the hashing function algorithm that should be used * @param content the content to be hashed; may not be null * @return the hash of the contents as a byte array * @throws NoSuchAlgorithmException if the supplied algorithm could not be found * @throws IllegalArgumentException if the algorithm is null */ public static byte[] getHash( Algorithm algorithm, byte[] content ) throws NoSuchAlgorithmException { CheckArg.isNotNull(algorithm, "algorithm"); return getHash(algorithm.digestName(), content); }
/** * @param name the model name (cannot be <code>null</code> or empty) * @param type the model type (can be <code>null</code> or empty) * @param pathInVdb the model path (can be <code>null</code> or empty) */ public VdbModel( String name, String type, String pathInVdb ) { CheckArg.isNotEmpty( name, "name" ); this.name = name; this.pathInVdb = pathInVdb; this.type = ( StringUtil.isBlank( type ) ? DEFAULT_MODEL_TYPE : type ); }
/** * Construct a Reflection instance that cache's some information about the target class. The target class is the Class object * upon which the methods will be found. * * @param targetClass the target class * @throws IllegalArgumentException if the target class is null */ public Reflection( Class<?> targetClass ) { CheckArg.isNotNull(targetClass, "targetClass"); this.targetClass = targetClass; }
/** * Get the hash of the supplied content, using the supplied digest algorithm. * * @param algorithm the hashing function algorithm that should be used * @param content the content to be hashed; may not be null * @return the hash of the contents as a byte array * @throws NoSuchAlgorithmException if the supplied algorithm could not be found * @throws IllegalArgumentException if the algorithm is null */ public static byte[] getHash( Algorithm algorithm, byte[] content ) throws NoSuchAlgorithmException { CheckArg.isNotNull(algorithm, "algorithm"); return getHash(algorithm.digestName(), content); }
public Comparison( DynamicOperand operand1, Operator operator, StaticOperand operand2 ) { CheckArg.isNotNull(operand1, "operand1"); CheckArg.isNotNull(operator, "operator"); CheckArg.isNotNull(operand2, "operand2"); this.operand1 = operand1; this.operand2 = operand2; this.operator = operator; this.hc = HashCode.compute(this.operand1, this.operand2, this.operator); }
public Comparison( DynamicOperand operand1, Operator operator, StaticOperand operand2 ) { CheckArg.isNotNull(operand1, "operand1"); CheckArg.isNotNull(operator, "operator"); CheckArg.isNotNull(operand2, "operand2"); this.operand1 = operand1; this.operand2 = operand2; this.operator = operator; this.hc = HashCode.compute(this.operand1, this.operand2, this.operator); }
/** * Create a constraint requiring that a property exist on a node. * * @param selectorName the name of the node selector * @param propertyName the name of the property that must exist */ public PropertyExistence( SelectorName selectorName, String propertyName ) { CheckArg.isNotNull(selectorName, "selectorName"); CheckArg.isNotNull(propertyName, "propertyName"); this.selectorName = selectorName; this.propertyName = propertyName; this.hc = HashCode.compute(this.selectorName, this.propertyName); }
/** * Create a constraint requiring that a property exist on a node. * * @param selectorName the name of the node selector * @param propertyName the name of the property that must exist */ public PropertyExistence( SelectorName selectorName, String propertyName ) { CheckArg.isNotNull(selectorName, "selectorName"); CheckArg.isNotNull(propertyName, "propertyName"); this.selectorName = selectorName; this.propertyName = propertyName; this.hc = HashCode.compute(this.selectorName, this.propertyName); }