Java Doc for ByteWrap.java in  » Web-Framework » RSF » uk » org » ponder » byteutil » 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 » Web Framework » RSF » uk.org.ponder.byteutil 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   uk.org.ponder.byteutil.ByteWrap

All known Subclasses:   uk.org.ponder.byteutil.AirByteWrap,
ByteWrap
public class ByteWrap (Code)
A very useful utility class to wrap a sequence of bytes in an array, covering over to some extent the lack of pointers in the Java language.


Field Summary
public  byte[]bytes
     The array holding the bytes represented by this ByteWrap.
public  intoffset
     The offset within the array that the represented bytes begin.
protected  intsize
     The number of bytes starting at offset that form the represented sequence.

Constructor Summary
public  ByteWrap()
     The default constructor performs no initialization, for those who wish to use ByteWraps in the raw.
public  ByteWrap(int length)
     Constructs a new ByteWrap with the specified length.
public  ByteWrap(byte[] bytes, int offset, int size)
     Constructs a new ByteWrap wrapping a portion of an already existing array.

Method Summary
public  voidensureCapacity(int requiredsize)
     Ensures that this ByteWrap has enough capacity in its array to store content of the specified size, by rebinding it to a larger-sized array if necessary.
public  booleanequals(Object othero)
     Compares this ByteWrap with another object.
public  ByteWrapimbue(ByteWrap other, int index, int length)
     Imbues an already existing ByteWrap to wrap a portion of another ByteWrap.
final public static  StringintToHex(int tohex)
     Converts an integer to a string containing a hexadecimal representation.
Parameters:
  tohex - THe integer to be represented.
final public static  StringintToHex(int tohex, int bytes)
     Converts some number of low-order bytes of an integer into a hexadecimal representation in a String.
Parameters:
  tohex - The integer to be converted to hex.
Parameters:
  bytes - The number of low-order bytes (between 1 and 4) to be convertedinto hex.
public  intread_at1(int pos)
     Reads a byte from the specified position, interpreting it as the low-order byte of an int.
Parameters:
  pos - The position from which to read the byte.
public  intread_at2(int pos)
     Reads two bytes starting at the specified position, interpreting them as the low-order bytes of an int in the usual big-endian order.
Parameters:
  pos - The position from which to read bytes.
public  intread_at3(int pos)
     Reads three bytes starting at the specified position, interpreting them as the low-order bytes of an int in the usual big-endian order.
Parameters:
  pos - The position from which to read bytes.
public  intread_at4(int pos)
     Reads the bytes starting at the specified position, interpreting them as a int in the usual big-endian order.
Parameters:
  pos - The position from which to read bytes.
public  longread_at8(int pos)
     Reads the bytes starting at the specified position, interpreting them as a long in the usual big-endian order.
Parameters:
  pos - The position from which to read bytes.
public  voidshuffle(int fromposition, int amount)
     Shuffles part of the contents of this ByteWrap forwards, to make space for more elements at a particular position.
public  intsize()
     Returns the number of elements in the sequence wrapped by this ByteWrap.
public static  chartoHex(int nibble)
     Converts the supplied integer in the range [0..15] into its equivalent hexadecimal digit.
Parameters:
  nibble - The integer to be converted.
public  StringtoString()
     Represents this ByteWrap as a String for debugging purposes.
public  voidwrite_at(int pos, ByteWrap other)
     Writes the entire sequence from another ByteWrap to a specified position into this one.
public  voidwrite_at(int pos, ByteWrap other, int index, int length)
     Writes a portion of the sequence from another ByteWrap to a specified position into this one.
public  voidwrite_at1(int pos, int data)
     Writes the low-order byte of the supplied int at the specified position in the wrapped sequence.
Parameters:
  pos - The position to write the byte.
Parameters:
  data - The data to be written.
public  voidwrite_at2(int pos, int data)
     Writes the two low-order bytes of the supplied int one byte at a time starting at the specified position in the wrapped sequence.
public  voidwrite_at3(int pos, int data)
     Writes the three low-order bytes of the supplied int one byte at a time starting at the specified position in the wrapped sequence.
public  voidwrite_at4(int pos, int data)
     Writes the supplied int one byte at a time starting at the specified position in the wrapped sequence.
public  voidwrite_at8(int pos, long data)
     Writes the supplied long one byte at a time starting at the specified position in the wrapped sequence.

Field Detail
bytes
public byte[] bytes(Code)
The array holding the bytes represented by this ByteWrap.



offset
public int offset(Code)
The offset within the array that the represented bytes begin.



size
protected int size(Code)
The number of bytes starting at offset that form the represented sequence. Making this protected is an oddly inconistent decision, so sue me.




Constructor Detail
ByteWrap
public ByteWrap()(Code)
The default constructor performs no initialization, for those who wish to use ByteWraps in the raw.



ByteWrap
public ByteWrap(int length)(Code)
Constructs a new ByteWrap with the specified length. A new array of the correct length is constructed to represent the sequence, which begins at the beginning of the array.
Parameters:
  length - The length of the ByteWrap to be constructed.



ByteWrap
public ByteWrap(byte[] bytes, int offset, int size)(Code)
Constructs a new ByteWrap wrapping a portion of an already existing array.
Parameters:
  bytes - The array holding the sequence to be wrapped.
Parameters:
  offset - The index of the beginning of the sequence to be wrapped.
Parameters:
  size - The length of the sequence to be wrapped.




Method Detail
ensureCapacity
public void ensureCapacity(int requiredsize)(Code)
Ensures that this ByteWrap has enough capacity in its array to store content of the specified size, by rebinding it to a larger-sized array if necessary.
Parameters:
  requiredsize - The length of the sequence the ByteWrap is required tostore.



equals
public boolean equals(Object othero)(Code)
Compares this ByteWrap with another object. It will compare equal to another ByteWrap wrapping the same sequence of bytes. This method is very inefficient.
Parameters:
  othero - The ByteWrap to be compared to. true if the other object if the supplied object is aByteWrap wrapping the same sequence of bytes.



imbue
public ByteWrap imbue(ByteWrap other, int index, int length)(Code)
Imbues an already existing ByteWrap to wrap a portion of another ByteWrap.
Parameters:
  other - The other ByteWrap containing the sequence to be wrapped.
Parameters:
  index - The index within the other ByteWrap's sequence of the sequenceto be wrapped.
Parameters:
  length - The length of the sequence to be wrapped.



intToHex
final public static String intToHex(int tohex)(Code)
Converts an integer to a string containing a hexadecimal representation.
Parameters:
  tohex - THe integer to be represented. A string representing the integer's value in hexadecimal.



intToHex
final public static String intToHex(int tohex, int bytes)(Code)
Converts some number of low-order bytes of an integer into a hexadecimal representation in a String.
Parameters:
  tohex - The integer to be converted to hex.
Parameters:
  bytes - The number of low-order bytes (between 1 and 4) to be convertedinto hex. The required hexadecimal representation.



read_at1
public int read_at1(int pos)(Code)
Reads a byte from the specified position, interpreting it as the low-order byte of an int.
Parameters:
  pos - The position from which to read the byte. The byte sequence interpreted as a int



read_at2
public int read_at2(int pos)(Code)
Reads two bytes starting at the specified position, interpreting them as the low-order bytes of an int in the usual big-endian order.
Parameters:
  pos - The position from which to read bytes. The byte sequence interpreted as a int



read_at3
public int read_at3(int pos)(Code)
Reads three bytes starting at the specified position, interpreting them as the low-order bytes of an int in the usual big-endian order.
Parameters:
  pos - The position from which to read bytes. The byte sequence interpreted as a int



read_at4
public int read_at4(int pos)(Code)
Reads the bytes starting at the specified position, interpreting them as a int in the usual big-endian order.
Parameters:
  pos - The position from which to read bytes. The byte sequence interpreted as a int



read_at8
public long read_at8(int pos)(Code)
Reads the bytes starting at the specified position, interpreting them as a long in the usual big-endian order.
Parameters:
  pos - The position from which to read bytes. The byte sequence interpreted as a long



shuffle
public void shuffle(int fromposition, int amount)(Code)
Shuffles part of the contents of this ByteWrap forwards, to make space for more elements at a particular position. It is assumed there is enough space at the end of the wrapped array to accommodate the resulting expansion of the sequence.
Parameters:
  fromposition - The index at which more space is to be made.
Parameters:
  amount - The number of positions forward the data is to be shuffled.



size
public int size()(Code)
Returns the number of elements in the sequence wrapped by this ByteWrap. the number of elements in the sequence wrapped by this ByteWrap.



toHex
public static char toHex(int nibble)(Code)
Converts the supplied integer in the range [0..15] into its equivalent hexadecimal digit.
Parameters:
  nibble - The integer to be converted. The integer represented as a hexadecimal digit.



toString
public String toString()(Code)
Represents this ByteWrap as a String for debugging purposes. If it contains 4 characters or less, it will be compactly represented as a hexadecimal number. If it is longer, it will be represented in a style similar to UNIX "od" or "dd" The contents of this ByteWrap as a debug string.



write_at
public void write_at(int pos, ByteWrap other)(Code)
Writes the entire sequence from another ByteWrap to a specified position into this one. The target ByteWrap is assumed to have enough space to accommodate the data.
Parameters:
  pos - The position within this ByteWrap to write the sequence.
Parameters:
  other - The ByteWrap wrapping the sequence to be copied.



write_at
public void write_at(int pos, ByteWrap other, int index, int length)(Code)
Writes a portion of the sequence from another ByteWrap to a specified position into this one. The target ByteWrap is assumed to have enough space to accommodate the data.
Parameters:
  pos - The position within this ByteWrap to write the sequence.
Parameters:
  other - The ByteWrap wrapping the sequence to be copied.
Parameters:
  index - The index within the other ByteWrap marking the start of the sequenceto be copied.
Parameters:
  length - The length of the sequence to be copied.



write_at1
public void write_at1(int pos, int data)(Code)
Writes the low-order byte of the supplied int at the specified position in the wrapped sequence.
Parameters:
  pos - The position to write the byte.
Parameters:
  data - The data to be written.



write_at2
public void write_at2(int pos, int data)(Code)
Writes the two low-order bytes of the supplied int one byte at a time starting at the specified position in the wrapped sequence. The data is written in the normal big-endian order.
Parameters:
  pos - The position to start writing the bytes.
Parameters:
  data - The data to be written.



write_at3
public void write_at3(int pos, int data)(Code)
Writes the three low-order bytes of the supplied int one byte at a time starting at the specified position in the wrapped sequence. The data is written in the normal big-endian order.
Parameters:
  pos - The position to start writing the bytes.
Parameters:
  data - The data to be written.



write_at4
public void write_at4(int pos, int data)(Code)
Writes the supplied int one byte at a time starting at the specified position in the wrapped sequence. The data is written in the normal big-endian order.
Parameters:
  pos - The position to start writing the bytes.
Parameters:
  data - The data to be written.



write_at8
public void write_at8(int pos, long data)(Code)
Writes the supplied long one byte at a time starting at the specified position in the wrapped sequence. The data is written in the normal big-endian order.
Parameters:
  pos - The position to start writing the bytes.
Parameters:
  data - The data to be written.



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.