Java Doc for ArrayUtil.java in  » Testing » mockrunner-0.4 » com » mockrunner » util » common » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » mockrunner 0.4 » com.mockrunner.util.common 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.mockrunner.util.common.ArrayUtil

ArrayUtil
public class ArrayUtil (Code)
Util class for arrays




Method Summary
public static  voidaddBytesToList(byte[] data, List list, int index)
     Copies the bytes from the specified array to the specified List as Byte objects starting at the specified index.
public static  voidaddBytesToList(byte[] data, int offset, int len, List list, int index)
     Copies the bytes from the specified array to the specified List as Byte objects starting at the specified index.
public static  booleanareArraysEqual(Object array1, Object array2)
     Compares the two specified arrays.
public static  intcomputeHashCode(Object array)
     Returns a suitable hash code for the specified array.
public static  ObjectconvertToArray(Object object)
     Creates an array with a single object as component. If the specified object is an array, it will be returned unchanged.
public static  Object[]convertToObjectArray(Object sourceArray)
     Returns an object array by wrapping primitive types.
public static  ObjectconvertToPrimitiveArray(Object[] sourceArray)
     Returns a primitive array by unwrapping the corresponding types.
public static  ObjectcopyArray(Object array)
     Returns a copy of the specified array.
public static  voidensureUnique(String[] values)
     Ensures that each entry in the specified string array is unique by adding a number to duplicate entries. I.e.
public static  byte[]getByteArrayFromList(List data)
     Returns a byte array containing the bytes from the List.
public static  byte[]getByteArrayFromList(List data, int index)
     Returns a byte array containing the bytes from the List.
public static  byte[]getByteArrayFromList(List data, int index, int len)
     Returns a byte array containing the bytes from the List.
public static  ListgetListFromByteArray(byte[] data)
     Returns a List containing the bytes from the specified array as Byte objects.
public static  intindexOf(byte[] source, byte[] bytes)
     Returns the index of the first occurence of the array bytes in the array source.
public static  intindexOf(byte[] source, byte[] bytes, int index)
     Returns the index of the first occurence of the array bytes in the array source.
public static  ObjecttruncateArray(Object sourceArray, int len)
     Returns a truncated copy of sourceArray.
public static  ObjecttruncateArray(Object sourceArray, int index, int len)
     Returns a truncated copy of sourceArray.



Method Detail
addBytesToList
public static void addBytesToList(byte[] data, List list, int index)(Code)
Copies the bytes from the specified array to the specified List as Byte objects starting at the specified index. Grows the list if necessary. index must be a valid index in the list.
Parameters:
  data - the byte data
Parameters:
  list - the List
Parameters:
  index - the index at which to start copying



addBytesToList
public static void addBytesToList(byte[] data, int offset, int len, List list, int index)(Code)
Copies the bytes from the specified array to the specified List as Byte objects starting at the specified index. Grows the list if necessary. index must be a valid index in the list.
Parameters:
  data - the byte data
Parameters:
  offset - the offset into the byte array at which to start
Parameters:
  len - the number of bytes to copy
Parameters:
  list - the List
Parameters:
  index - the index at which to start copying



areArraysEqual
public static boolean areArraysEqual(Object array1, Object array2)(Code)
Compares the two specified arrays. If both passed objects are null, true is returned. If both passed objects are not arrays, they are compared using equals. Otherwise all array elements are compared using equals. This method does not handle multidimensional arrays, i.e. if an array contains another array, comparison is based on identity.
Parameters:
  array1 - the first array
Parameters:
  array2 - the second array true if the arrays are equal, falseotherwise



computeHashCode
public static int computeHashCode(Object array)(Code)
Returns a suitable hash code for the specified array. If the passed object is null, 0 is returned. It is allowed to pass an object that is not an array, in this case, the hash code of the object will be returned. Otherwise the hash code will be based on the array elements. null elements are allowed. This method does not handle multidimensional arrays, i.e. if an array contains another array, the hash code is based on identity.
Parameters:
  array - the array a suitable hash code



convertToArray
public static Object convertToArray(Object object)(Code)
Creates an array with a single object as component. If the specified object is an array, it will be returned unchanged. Otherwise an array with the specified object as the single element will be returned.
Parameters:
  object - the object the corresponding array



convertToObjectArray
public static Object[] convertToObjectArray(Object sourceArray)(Code)
Returns an object array by wrapping primitive types. If the specified array is of primitive component type, an Object[] with the corresponding wrapper component type is returned. If the specified array is already an object array, the instance is returned unchanged.
Parameters:
  sourceArray - the array the corresponding object array
throws:
  IllegalArgumentException - if the specified objectis not an array (either of reference or primitivecomponent type)



convertToPrimitiveArray
public static Object convertToPrimitiveArray(Object[] sourceArray)(Code)
Returns a primitive array by unwrapping the corresponding types. If the specified array is not an array of primitive wrapper types (e.g. Integer[]), an IllegalArgumentException will be thrown. If an array element is null, an IllegalArgumentException will be thrown.
Parameters:
  sourceArray - the array the corresponding primitive array
throws:
  IllegalArgumentException - if the specified arrayis not an array of primitive wrapper types or if anarray element is null



copyArray
public static Object copyArray(Object array)(Code)
Returns a copy of the specified array. If array is not an array, the object itself will be returned. Otherwise a copy of the array will be returned. The components themselves are not cloned.
Parameters:
  array - the array the copy of the array



ensureUnique
public static void ensureUnique(String[] values)(Code)
Ensures that each entry in the specified string array is unique by adding a number to duplicate entries. I.e. if the string "entry" occurs three times, the three entries will be renamed to "entry1", "entry2" and "entry3".
Parameters:
  values - the array of strings



getByteArrayFromList
public static byte[] getByteArrayFromList(List data)(Code)
Returns a byte array containing the bytes from the List. The List must contain Byte objects. null entries in the List are allowed, the resulting byte will be 0.
Parameters:
  data - the List the resulting byte array



getByteArrayFromList
public static byte[] getByteArrayFromList(List data, int index)(Code)
Returns a byte array containing the bytes from the List. The List must contain Byte objects. null entries in the List are allowed, the resulting byte will be 0.
Parameters:
  data - the List
Parameters:
  index - the index at which to start the resulting byte array



getByteArrayFromList
public static byte[] getByteArrayFromList(List data, int index, int len)(Code)
Returns a byte array containing the bytes from the List. The List must contain Byte objects. null entries in the List are allowed, the resulting byte will be 0.
Parameters:
  data - the List
Parameters:
  index - the index at which to start
Parameters:
  len - the number of bytes the resulting byte array



getListFromByteArray
public static List getListFromByteArray(byte[] data)(Code)
Returns a List containing the bytes from the specified array as Byte objects.
Parameters:
  data - the byte data the List with the Byte objects



indexOf
public static int indexOf(byte[] source, byte[] bytes)(Code)
Returns the index of the first occurence of the array bytes in the array source.
Parameters:
  source - the array in which to search
Parameters:
  bytes - the array to search the index of the first occurence or-1, if source does not contain bytes



indexOf
public static int indexOf(byte[] source, byte[] bytes, int index)(Code)
Returns the index of the first occurence of the array bytes in the array source.
Parameters:
  source - the array in which to search
Parameters:
  bytes - the array to search
Parameters:
  index - the index where to begin the search the index of the first occurence or-1, if source does not contain bytes



truncateArray
public static Object truncateArray(Object sourceArray, int len)(Code)
Returns a truncated copy of sourceArray. len entries are copied.
Parameters:
  sourceArray - the source array
Parameters:
  len - the truncate length the truncated array
throws:
  IllegalArgumentException - if the specified objectis not an array (either of reference or primitivecomponent type)



truncateArray
public static Object truncateArray(Object sourceArray, int index, int len)(Code)
Returns a truncated copy of sourceArray. len entries are copied starting at the specified index.
Parameters:
  sourceArray - the source array
Parameters:
  index - the start index
Parameters:
  len - the truncate length the truncated array
throws:
  IllegalArgumentException - if the specified objectis not an array (either of reference or primitivecomponent type)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.