List of usage examples for java.util Arrays equals
public static boolean equals(Object[] a, Object[] a2)
From source file:bftsmart.consensus.TimestampValuePair.java
@Override public boolean equals(Object o) { if (o instanceof TimestampValuePair) { return ((TimestampValuePair) o).timestamp == timestamp && Arrays.equals(((TimestampValuePair) o).value, value); }//from w w w . j a va 2s .c o m return false; }
From source file:libepg.util.bytearray.ByteDataBlock.java
@Override public boolean equals(Object obj) { if (this == obj) { return true; }/* w ww. ja v a 2 s.c o m*/ if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ByteDataBlock other = (ByteDataBlock) obj; if (!Arrays.equals(this.data, other.data)) { return false; } return true; }
From source file:org.killbill.billing.plugin.meter.timeline.chunks.TimeBytesAndSampleBytes.java
@Override public boolean equals(final Object o) { if (this == o) { return true; }/*from w w w . j av a2 s. c o m*/ if (o == null || getClass() != o.getClass()) { return false; } final TimeBytesAndSampleBytes that = (TimeBytesAndSampleBytes) o; if (!Arrays.equals(sampleBytes, that.sampleBytes)) { return false; } if (!Arrays.equals(timeBytes, that.timeBytes)) { return false; } return true; }
From source file:com.adeptj.runtime.server.CredentialMatcher.java
private static boolean fromServerConfig(String id, char[] password) { return Configs.of().undertow().getObject(KEY_USER_CREDENTIAL_MAPPING).unwrapped().entrySet().stream() .anyMatch(entry -> StringUtils.equals(entry.getKey(), id) && Arrays.equals(makeHash(password), ((String) entry.getValue()).toCharArray())); }
From source file:ch.admin.isb.hermes5.util.ImageUtilsTest.java
@Test public void testToPNG() { byte[] gifStream = getResourceAsStream("logo.jpg"); BufferedImage bufferedImage = imageUtil.toBufferedImage(gifStream); byte[] png = imageUtil.toPNGByteArray(bufferedImage); assertNotNull(png);//from ww w . j a v a2s . c om assertFalse(Arrays.equals(gifStream, png)); }
From source file:io.adeptj.runtime.server.CredentialMatcher.java
private static boolean fromOSGiManagerConfig(String pwd) { try {//from ww w. ja va2s . c o m return Arrays.equals(toHash(pwd).toCharArray(), OSGiConsolePasswordVault.INSTANCE.getPassword()); } catch (Exception ex) { // NOSONAR LOGGER.error("Exception!!", ex); } return false; }
From source file:cz.lbenda.common.BitArrayBinaryData.java
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof BitArrayBinaryData)) return false; BitArrayBinaryData that = (BitArrayBinaryData) o; return Arrays.equals(bytes, that.bytes); }
From source file:com.spartan.springmvc.bean.FacebookSignatureBean.java
/** * Parses and verifies a Facebook signed_request parameter. The data of the signed request is returned on successful verification. * * @param signedRequest/*from www . j av a 2 s .c o m*/ * @param appSecret * @return * @return * @throws FacebookSignatureVerificationFailedException */ @SuppressWarnings("unchecked") public <T> T parseSignature(String signedRequest, String appSecret, Class<T> clazz) throws FacebookSignatureVerificationFailedException { String[] parts = signedRequest.split("\\."); if (parts.length != 2) { throw new FacebookSignatureVerificationFailedException("Invalid signature format."); } String encSig = parts[0]; String encPayload = parts[1]; Base64 decoder = new Base64(true); try { Mac mac = Mac.getInstance("HMACSHA256"); mac.init(new SecretKeySpec(appSecret.getBytes(), mac.getAlgorithm())); byte[] calcSig = mac.doFinal(encPayload.getBytes()); byte[] decodedSig = decoder.decode(encSig); boolean isVerified = Arrays.equals(decodedSig, calcSig); if (isVerified) { try { String unsignedData = new String(decoder.decode(encPayload)); logger.debug("unsignedData: " + unsignedData); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); T data = mapper.readValue(unsignedData, (Class<T>) clazz); return data; } catch (IOException e) { throw new FacebookSignatureVerificationFailedException( "Failed to parse JSON data: " + e.getMessage(), e); } } else { throw new FacebookSignatureVerificationFailedException("Signatures do not match."); } } catch (NoSuchAlgorithmException e) { throw new FacebookSignatureVerificationFailedException(e); } catch (InvalidKeyException e) { throw new FacebookSignatureVerificationFailedException(e); } }
From source file:net.bluehornreader.model.ReadArticlesColl.java
/** * for testing only/*from w ww .j a v a 2 s . co m*/ * * @param o * @return */ public boolean testEqual(ReadArticlesColl o) { if (first != o.first) return false; if (!Arrays.equals(bitmap, o.bitmap)) return false; return true; }
From source file:net.lizalab.util.RdRandRandomTest.java
/** * Verifies Generation of random bytes and their population * in the specified array./*from w w w. jav a 2s .c om*/ */ @Test public final void testNextBytes() { // Prepare array to receive random bytes byte[] bytes = new byte[32]; Random random = new RdRandRandom(); random.nextBytes(bytes); byte[] emptyBytes = new byte[32]; // Verify the library filled the provided array with random byte values. assertFalse(Arrays.equals(bytes, emptyBytes)); }