当前位置: 首页>>代码示例>>Java>>正文


Java System.arraycopy方法代码示例

本文整理汇总了Java中java.lang.System.arraycopy方法的典型用法代码示例。如果您正苦于以下问题:Java System.arraycopy方法的具体用法?Java System.arraycopy怎么用?Java System.arraycopy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.lang.System的用法示例。


在下文中一共展示了System.arraycopy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: for

import java.lang.System; //导入方法依赖的package包/类
/***************************************************************
   Function: trunc_col
   Description: Truncates each column to the 'correct' length.
   **************************************************************/
 private void trunc_col
   (
    )
     {
int n;
int i;
CDTrans dtrans;

n = m_spec.m_dtrans_vector.size();
for (i = 0; i < n; ++i)
  {
    int[] ndtrans = new int[m_spec.m_dtrans_ncols];
    dtrans = (CDTrans) m_spec.m_dtrans_vector.elementAt(i);
    System.arraycopy(dtrans.m_dtrans, 0, ndtrans, 0, ndtrans.length);
    dtrans.m_dtrans = ndtrans;
  }
     }
 
开发者ID:rchain,项目名称:Rholang,代码行数:22,代码来源:Main.java

示例2: ArrayListCursor

import java.lang.System; //导入方法依赖的package包/类
@SuppressWarnings({"unchecked"})
public ArrayListCursor(String[] columnNames, ArrayList<ArrayList> rows) {
    int colCount = columnNames.length;
    boolean foundID = false;
    // Add an _id column if not in columnNames
    for (int i = 0; i < colCount; ++i) {
        if (columnNames[i].compareToIgnoreCase("_id") == 0) {
            mColumnNames = columnNames;
            foundID = true;
            break;
        }
    }

    if (!foundID) {
        mColumnNames = new String[colCount + 1];
        System.arraycopy(columnNames, 0, mColumnNames, 0, columnNames.length);
        mColumnNames[colCount] = "_id";
    }

    int rowCount = rows.size();
    mRows = new ArrayList[rowCount];

    for (int i = 0; i < rowCount; ++i) {
        mRows[i] = rows.get(i);
        if (!foundID) {
            mRows[i].add(i);
        }
    }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:30,代码来源:ArrayListCursor.java

示例3: new_block

import java.lang.System; //导入方法依赖的package包/类
private void new_block(int idx, int bnum) {
if (size==bits.length) { // resize
    long[] nbits = new long[size*3];
    int [] noffs = new int [size*3];
    System.arraycopy(bits, 0, nbits, 0, size);
    System.arraycopy(offs, 0, noffs, 0, size);
    bits = nbits;
    offs = noffs;
}
CUtility.ASSERT(size<bits.length);
insert_block(idx, bnum);
   }
 
开发者ID:rchain,项目名称:Rholang,代码行数:13,代码来源:Main.java

示例4: insert_block

import java.lang.System; //导入方法依赖的package包/类
private void insert_block(int idx, int bnum) {
CUtility.ASSERT(idx<=size);
CUtility.ASSERT(idx==size || offs[idx]!=bnum);
System.arraycopy(bits, idx, bits, idx+1, size-idx);
System.arraycopy(offs, idx, offs, idx+1, size-idx);
offs[idx]=bnum;
bits[idx]=0; //clear them bits.
size++;
   }
 
开发者ID:rchain,项目名称:Rholang,代码行数:10,代码来源:Main.java

示例5: readIncremental

import java.lang.System; //导入方法依赖的package包/类
private int readIncremental(byte[] buffer, int offset, int length) throws IOException {
  int readLength = 0;
  if (null != overflowBuffer) {
    if (overflowBuffer.length > length) {
      System.arraycopy(overflowBuffer, 0, buffer, offset, length);
      overflowBuffer = Arrays.copyOfRange(overflowBuffer, length, overflowBuffer.length);
      return length;
    } else if (overflowBuffer.length == length) {
      System.arraycopy(overflowBuffer, 0, buffer, offset, length);
      overflowBuffer = null;
      return length;
    } else {
      System.arraycopy(overflowBuffer, 0, buffer, offset, overflowBuffer.length);
      readLength += overflowBuffer.length;
      offset += readLength;
      length -= readLength;
      overflowBuffer = null;
    }
  }

  if (length + totalRead > totalDataSize)
    length = (int)(totalDataSize - totalRead);

  byte[] internalBuffer = new byte[length];
  int read              = super.read(internalBuffer, 0, internalBuffer.length <= cipher.getBlockSize() ? internalBuffer.length : internalBuffer.length - cipher.getBlockSize());
  totalRead            += read;

  try {
    mac.update(internalBuffer, 0, read);

    int outputLen = cipher.getOutputSize(read);

    if (outputLen <= length) {
      readLength += cipher.update(internalBuffer, 0, read, buffer, offset);
      return readLength;
    }

    byte[] transientBuffer = new byte[outputLen];
    outputLen = cipher.update(internalBuffer, 0, read, transientBuffer, 0);
    if (outputLen <= length) {
      System.arraycopy(transientBuffer, 0, buffer, offset, outputLen);
      readLength += outputLen;
    } else {
      System.arraycopy(transientBuffer, 0, buffer, offset, length);
      overflowBuffer = Arrays.copyOfRange(transientBuffer, length, outputLen);
      readLength += length;
    }
    return readLength;
  } catch (ShortBufferException e) {
    throw new AssertionError(e);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:53,代码来源:DecryptingPartInputStream.java

示例6: randombytes

import java.lang.System; //导入方法依赖的package包/类
public static byte[] randombytes(byte [] x, int len) {
   byte [] b = randombytes(len);
   System.arraycopy(b, 0, x, 0, len);
   return x;
}
 
开发者ID:legarspol,项目名称:miniLock-android,代码行数:6,代码来源:TweetNaclFast.java

示例7: binop

import java.lang.System; //导入方法依赖的package包/类
private static final void binop(SparseBitSet a, SparseBitSet b, BinOp op) {
int  nsize = a.size + b.size;
long[] nbits; 
int [] noffs;
int a_zero, a_size;
// be very clever and avoid allocating more memory if we can.
if (a.bits.length < nsize) { // oh well, have to make working space.
    nbits = new long[nsize];
    noffs = new int [nsize];
    a_zero  = 0; a_size = a.size;
} else { // reduce, reuse, recycle!
    nbits = a.bits;
    noffs = a.offs;
    a_zero = a.bits.length - a.size; a_size = a.bits.length;
    System.arraycopy(a.bits, 0, a.bits, a_zero, a.size);
    System.arraycopy(a.offs, 0, a.offs, a_zero, a.size);
}
// ok, crunch through and binop those sets!
nsize = 0;
for (int i=a_zero, j=0; i<a_size || j<b.size; ) {
    long nb; int no;
    if (i<a_size && (j>=b.size || a.offs[i] < b.offs[j])) {
	nb = op.op(a.bits[i], 0);
	no = a.offs[i];
	i++;
    } else if (j<b.size && (i>=a_size || a.offs[i] > b.offs[j])) {
	nb = op.op(0, b.bits[j]);
	no = b.offs[j];
	j++;
    } else { // equal keys; merge.
	nb = op.op(a.bits[i], b.bits[j]);
	no = a.offs[i];
	i++; j++;
    }
    if (nb!=0) {
	nbits[nsize] = nb;
	noffs[nsize] = no;
	nsize++;
    }
}
a.bits = nbits;
a.offs = noffs;
a.size = nsize;
   }
 
开发者ID:rchain,项目名称:Rholang,代码行数:45,代码来源:Main.java


注:本文中的java.lang.System.arraycopy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。