Share

Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





#Java - Code Snippets for '#System.arraycopy' - 7 code snippet(s) found

 Sample 1. Copy Array using System.arraycopy

String[] stringArray = new String[50];
String[] newStringArray = new String[50];
System.arraycopy(stringArray, 0, newStringArray, 0, 50); //arrayCopy(src,srcPosition,destination,destinationPos,length)

   Like      Feedback     System.arraycopy  Copy array  arrays  array of string


 Sample 2. Code Sample / Example / Snippet of org.apache.hadoop.util.MergeSort

  public RawKeyValueIterator sort() {

MergeSort m = new MergeSort(this);

int count = super.count;

if (count == 0) return null;

int [] pointers = super.pointers;

int [] pointersCopy = new int[count];

System.arraycopy(pointers, 0, pointersCopy, 0, count);

m.mergeSort(pointers, pointersCopy, 0, count);

return new MRSortResultIterator(super.keyValBuffer, pointersCopy,

super.startOffsets, super.keyLengths, super.valueLengths);

}


   Like      Feedback      org.apache.hadoop.util.MergeSort


 Sample 3. Code Sample / Example / Snippet of org.apache.bcel.classfile.ConstantUtf8

    public static String[] getClassDependencies(ConstantPool pool) {

String[] tempArray = new String[pool.getLength()];

int size = 0;

StringBuilder buf = new StringBuilder();



for (int idx = 0; idx < pool.getLength(); idx++) {

Constant c = pool.getConstant(idx);

if (c != null && c.getTag() == Constants.CONSTANT_Class) {

ConstantUtf8 c1 = (ConstantUtf8) pool.getConstant(((ConstantClass) c).getNameIndex());

buf.setLength(0);

buf.append(c1.getBytes());

for (int n = 0; n < buf.length(); n++) {

if (buf.charAt(n) == '/') {

buf.setCharAt(n, '.');

}

}



tempArray[size++] = buf.toString();

}

}



String[] dependencies = new String[size];

System.arraycopy(tempArray, 0, dependencies, 0, size);

return dependencies;

}


   Like      Feedback      org.apache.bcel.classfile.ConstantUtf8


 Sample 4. Code Sample / Example / Snippet of org.apache.bcel.classfile.Deprecated

    public Attribute copy( final ConstantPool _constant_pool ) {

final Deprecated c = (Deprecated) clone();

if (bytes != null) {

c.bytes = new byte[bytes.length];

System.arraycopy(bytes, 0, c.bytes, 0, bytes.length);

}

c.setConstantPool(_constant_pool);

return c;

}


   Like      Feedback      org.apache.bcel.classfile.Deprecated


Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner
 Sample 5. Code Sample / Example / Snippet of org.apache.bcel.classfile.Synthetic

    public Attribute copy( final ConstantPool _constant_pool ) {

final Synthetic c = (Synthetic) clone();

if (bytes != null) {

c.bytes = new byte[bytes.length];

System.arraycopy(bytes, 0, c.bytes, 0, bytes.length);

}

c.setConstantPool(_constant_pool);

return c;

}


   Like      Feedback      org.apache.bcel.classfile.Synthetic


 Sample 6. Code Sample / Example / Snippet of org.apache.bcel.classfile.Node

  public void jjtAddChild(Node n, int i) {

if (children == null) {

children = new Node[i + 1];

} else if (i >= children.length) {

Node c[] = new Node[i + 1];

System.arraycopy(children, 0, c, 0, children.length);

children = c;

}

children[i] = n;

}


   Like      Feedback      org.apache.bcel.classfile.Node


 Sample 7. Code Sample / Example / Snippet of org.apache.bcel.classfile.Unknown

    public Attribute copy( final ConstantPool _constant_pool ) {

final Unknown c = (Unknown) clone();

if (bytes != null) {

c.bytes = new byte[bytes.length];

System.arraycopy(bytes, 0, c.bytes, 0, bytes.length);

}

c.setConstantPool(_constant_pool);

return c;

}


   Like      Feedback      org.apache.bcel.classfile.Unknown



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus