All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fasterxml.storemate.shared.util.WithBytesAsArray Maven / Gradle / Ivy

There is a newer version: 1.1.4
Show newest version
package com.fasterxml.storemate.shared.util;

import java.util.Arrays;

/**
 * Simple {@link WithBytesCallback} implementation to use when all you
 * really want is a byte array copy.
 */
public class WithBytesAsArray implements WithBytesCallback
{
    public final static WithBytesAsArray instance = new WithBytesAsArray();

    @Override
    public byte[] withBytes(byte[] buffer, int offset, int length) {
        if (offset == 0) {
            return Arrays.copyOf(buffer, length);
        }
        return Arrays.copyOfRange(buffer, offset, offset+length);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy