Here you can find the source of setBytes(final byte[] dest, final byte[] data, final int offset, int length)
Parameter | Description |
---|---|
dest | bytes array which will contain the given bytes after the call |
data | a bunch of bytes to be added to the array |
offset | from where the data to be add to the dest |
length | length of the bytes to be add |
public static void setBytes(final byte[] dest, final byte[] data, final int offset, int length)
//package com.java2s; /**/* w w w. j a v a 2s. c o m*/ * Created on Oct 21, 2010 * This file is part of JObexFTP 2.0, and it contains parts of OBEX4J. * * JObexFTP is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * JObexFTP is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with JObexFTP. If not, see <http://www.gnu.org/licenses/>. * */ public class Main { /** * add a bunch of bytes to the byte array with offset * * @param dest bytes array which will contain the given bytes after the call * @param data a bunch of bytes to be added to the array * @param offset from where the data to be add to the dest * @param length length of the bytes to be add */ public static void setBytes(final byte[] dest, final byte[] data, final int offset, int length) { if (offset + length > dest.length) { return; } for (int i = 0; i < length; i++) { dest[offset + i] = data[i]; } } }