/** * Appends the contents of a byte array to an append blob.This API should be used strictly in a single writer * scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which * does not work in a multiple writer scenario. * <p> * If you are doing writes in a single writer scenario, please look at * {@link BlobRequestOptions#setAbsorbConditionalErrorsOnRetry(Boolean)} and see if setting this flag * to <code>true</code> is acceptable for you. * * @param buffer * A <code>byte</code> array which represents the data to append to the blob. * @param offset * A <code>int</code> which represents the offset of the byte array from which to start the data upload. * @param length * An <code>int</code> which represents the number of bytes to upload from the input buffer. * * @throws StorageException * If a storage service error occurred. * @throws IOException * If an I/O exception occurred. */ public void appendFromByteArray(final byte[] buffer, final int offset, final int length) throws StorageException, IOException { appendFromByteArray(buffer, offset, length, null /* accessCondition */, null /* options */, null /* opContext */); }
/** * Appends the contents of a byte array to an append blob.This API should be used strictly in a single writer * scenario because the API internally uses the append-offset conditional header to avoid duplicate blocks which * does not work in a multiple writer scenario. * <p> * If you are doing writes in a single writer scenario, please look at * {@link BlobRequestOptions#setAbsorbConditionalErrorsOnRetry(Boolean)} and see if setting this flag * to <code>true</code> is acceptable for you. * * @param buffer * A <code>byte</code> array which represents the data to append to the blob. * @param offset * A <code>int</code> which represents the offset of the byte array from which to start the data upload. * @param length * An <code>int</code> which represents the number of bytes to upload from the input buffer. * * @throws StorageException * If a storage service error occurred. * @throws IOException * If an I/O exception occurred. */ public void appendFromByteArray(final byte[] buffer, final int offset, final int length) throws StorageException, IOException { appendFromByteArray(buffer, offset, length, null /* accessCondition */, null /* options */, null /* opContext */); }
BlobRequestOptions options, OperationContext opContext) throws StorageException, IOException { byte[] bytes = (charsetName == null) ? content.getBytes() : content.getBytes(charsetName); this.appendFromByteArray(bytes, 0, bytes.length, accessCondition, options, opContext);
BlobRequestOptions options, OperationContext opContext) throws StorageException, IOException { byte[] bytes = (charsetName == null) ? content.getBytes() : content.getBytes(charsetName); this.appendFromByteArray(bytes, 0, bytes.length, accessCondition, options, opContext);
@Override protected void append(ILoggingEvent event) { if (differentDay(date, new Date())) { roll(); } byte[] message; if(encoder == null) { message = event.getFormattedMessage().getBytes(); } else { message = encoder.encode(event); } try { blob.appendFromByteArray(message, 0, message.length); } catch (StorageException ex) { throw new RuntimeException(ex); } catch (IOException ex) { throw new RuntimeException(ex); } }