/** * Set the referenceKey from Base64 encoded byte array * @param encodedKey base64 encoded key */ public void setReferenceKeyEncoded(String encodedKey) { setReferenceKey(BaseEncoding.base64().decode(encodedKey)); }
/** * Set the referenceKey from Base64 encoded byte array * @param encodedKey base64 encoded key */ public void setReferenceKeyEncoded(String encodedKey) { setReferenceKey(BaseEncoding.base64().decode(encodedKey)); }
/** * Set the referenceKey from Base64 encoded byte array * @param encodedKey base64 encoded key */ public void setReferenceKeyEncoded(String encodedKey) { setReferenceKey(BaseEncoding.base64().decode(encodedKey)); }
/** * Set the referenceKey from plain text. Key content would be UTF-8 encoding * of the string. * * <p> * This is useful when setting key via generic bean property manipulation * from string properties. User can specify the key in plain text and that * would be passed on this object via * {@link org.apache.jackrabbit.oak.commons.PropertiesUtil#populate(Object, java.util.Map, boolean)} * * @param textKey base64 encoded key * @see org.apache.jackrabbit.oak.commons.PropertiesUtil#populate(Object, * java.util.Map, boolean) */ public void setReferenceKeyPlainText(String textKey) { setReferenceKey(textKey.getBytes(Charsets.UTF_8)); }
/** * Set the referenceKey from plain text. Key content would be UTF-8 encoding * of the string. * * <p> * This is useful when setting key via generic bean property manipulation * from string properties. User can specify the key in plain text and that * would be passed on this object via * {@link org.apache.jackrabbit.oak.commons.PropertiesUtil#populate(Object, java.util.Map, boolean)} * * @param textKey base64 encoded key * @see org.apache.jackrabbit.oak.commons.PropertiesUtil#populate(Object, * java.util.Map, boolean) */ public void setReferenceKeyPlainText(String textKey) { setReferenceKey(textKey.getBytes(Charsets.UTF_8)); }
/** * Set the referenceKey from plain text. Key content would be UTF-8 encoding * of the string. * * <p> * This is useful when setting key via generic bean property manipulation * from string properties. User can specify the key in plain text and that * would be passed on this object via * {@link org.apache.jackrabbit.oak.commons.PropertiesUtil#populate(Object, java.util.Map, boolean)} * * @param textKey base64 encoded key * @see org.apache.jackrabbit.oak.commons.PropertiesUtil#populate(Object, * java.util.Map, boolean) */ public void setReferenceKeyPlainText(String textKey) { setReferenceKey(textKey.getBytes(Charsets.UTF_8)); }
@Test public void testReference() throws Exception { assumeThat(store, instanceOf(AbstractBlobStore.class)); AbstractBlobStore abs = (AbstractBlobStore) store; Random r = new Random(); byte[] key = new byte[256]; r.nextBytes(key); abs.setReferenceKey(key); byte[] data = new byte[1000]; r.nextBytes(data); String blobId = store.writeBlob(new ByteArrayInputStream(data)); String reference = store.getReference(blobId); String blobId2 = store.getBlobId(reference); assertEquals(blobId, blobId2); }