Java Doc for EndianUtils.java in  » Library » apache-common-IO » org » apache » commons » io » 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 » Library » apache common IO » org.apache.commons.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.io.EndianUtils

EndianUtils
public class EndianUtils (Code)
Utility code for dealing with different endian systems.

Different computer architectures adopt different conventions for byte ordering. In so-called "Little Endian" architectures (eg Intel), the low-order byte is stored in memory at the lowest address, and subsequent bytes at higher addresses. For "Big Endian" architectures (eg Motorola), the situation is reversed. This class helps you solve this incompatability.

Origin of code: Excalibur
author:
   Peter Donald
version:
   $Id: EndianUtils.java 539638 2007-05-18 23:44:30Z bayard $
See Also:   org.apache.commons.io.input.SwappedDataInputStream




Constructor Summary
public  EndianUtils()
     Instances should NOT be constructed in standard programming.

Method Summary
public static  doublereadSwappedDouble(byte[] data, int offset)
     Reads a "double" value from a byte array at a given offset.
public static  doublereadSwappedDouble(InputStream input)
     Reads a "double" value from an InputStream.
public static  floatreadSwappedFloat(byte[] data, int offset)
     Reads a "float" value from a byte array at a given offset.
public static  floatreadSwappedFloat(InputStream input)
     Reads a "float" value from an InputStream.
public static  intreadSwappedInteger(byte[] data, int offset)
     Reads a "int" value from a byte array at a given offset.
public static  intreadSwappedInteger(InputStream input)
     Reads a "int" value from an InputStream.
public static  longreadSwappedLong(byte[] data, int offset)
     Reads a "long" value from a byte array at a given offset.
public static  longreadSwappedLong(InputStream input)
     Reads a "long" value from an InputStream.
public static  shortreadSwappedShort(byte[] data, int offset)
     Reads a "short" value from a byte array at a given offset.
public static  shortreadSwappedShort(InputStream input)
     Reads a "short" value from an InputStream.
public static  longreadSwappedUnsignedInteger(byte[] data, int offset)
     Reads an unsigned integer (32-bit) value from a byte array at a given offset.
public static  longreadSwappedUnsignedInteger(InputStream input)
     Reads a unsigned integer (32-bit) from an InputStream.
public static  intreadSwappedUnsignedShort(byte[] data, int offset)
     Reads an unsigned short (16-bit) value from a byte array at a given offset.
public static  intreadSwappedUnsignedShort(InputStream input)
     Reads a unsigned short (16-bit) from an InputStream.
public static  doubleswapDouble(double value)
     Converts a "double" value between endian systems.
public static  floatswapFloat(float value)
     Converts a "float" value between endian systems.
public static  intswapInteger(int value)
     Converts a "int" value between endian systems.
public static  longswapLong(long value)
     Converts a "long" value between endian systems.
public static  shortswapShort(short value)
     Converts a "short" value between endian systems.
public static  voidwriteSwappedDouble(byte[] data, int offset, double value)
     Writes a "double" value to a byte array at a given offset.
public static  voidwriteSwappedDouble(OutputStream output, double value)
     Writes a "double" value to an OutputStream.
public static  voidwriteSwappedFloat(byte[] data, int offset, float value)
     Writes a "float" value to a byte array at a given offset.
public static  voidwriteSwappedFloat(OutputStream output, float value)
     Writes a "float" value to an OutputStream.
public static  voidwriteSwappedInteger(byte[] data, int offset, int value)
     Writes a "int" value to a byte array at a given offset.
public static  voidwriteSwappedInteger(OutputStream output, int value)
     Writes a "int" value to an OutputStream.
public static  voidwriteSwappedLong(byte[] data, int offset, long value)
     Writes a "long" value to a byte array at a given offset.
public static  voidwriteSwappedLong(OutputStream output, long value)
     Writes a "long" value to an OutputStream.
public static  voidwriteSwappedShort(byte[] data, int offset, short value)
     Writes a "short" value to a byte array at a given offset.
public static  voidwriteSwappedShort(OutputStream output, short value)
     Writes a "short" value to an OutputStream.


Constructor Detail
EndianUtils
public EndianUtils()(Code)
Instances should NOT be constructed in standard programming.




Method Detail
readSwappedDouble
public static double readSwappedDouble(byte[] data, int offset)(Code)
Reads a "double" value from a byte array at a given offset. The value is converted to the opposed endian system while reading.
Parameters:
  data - source byte array
Parameters:
  offset - starting offset in the byte array the value read



readSwappedDouble
public static double readSwappedDouble(InputStream input) throws IOException(Code)
Reads a "double" value from an InputStream. The value is converted to the opposed endian system while reading.
Parameters:
  input - source InputStream the value just read
throws:
  IOException - in case of an I/O problem



readSwappedFloat
public static float readSwappedFloat(byte[] data, int offset)(Code)
Reads a "float" value from a byte array at a given offset. The value is converted to the opposed endian system while reading.
Parameters:
  data - source byte array
Parameters:
  offset - starting offset in the byte array the value read



readSwappedFloat
public static float readSwappedFloat(InputStream input) throws IOException(Code)
Reads a "float" value from an InputStream. The value is converted to the opposed endian system while reading.
Parameters:
  input - source InputStream the value just read
throws:
  IOException - in case of an I/O problem



readSwappedInteger
public static int readSwappedInteger(byte[] data, int offset)(Code)
Reads a "int" value from a byte array at a given offset. The value is converted to the opposed endian system while reading.
Parameters:
  data - source byte array
Parameters:
  offset - starting offset in the byte array the value read



readSwappedInteger
public static int readSwappedInteger(InputStream input) throws IOException(Code)
Reads a "int" value from an InputStream. The value is converted to the opposed endian system while reading.
Parameters:
  input - source InputStream the value just read
throws:
  IOException - in case of an I/O problem



readSwappedLong
public static long readSwappedLong(byte[] data, int offset)(Code)
Reads a "long" value from a byte array at a given offset. The value is converted to the opposed endian system while reading.
Parameters:
  data - source byte array
Parameters:
  offset - starting offset in the byte array the value read



readSwappedLong
public static long readSwappedLong(InputStream input) throws IOException(Code)
Reads a "long" value from an InputStream. The value is converted to the opposed endian system while reading.
Parameters:
  input - source InputStream the value just read
throws:
  IOException - in case of an I/O problem



readSwappedShort
public static short readSwappedShort(byte[] data, int offset)(Code)
Reads a "short" value from a byte array at a given offset. The value is converted to the opposed endian system while reading.
Parameters:
  data - source byte array
Parameters:
  offset - starting offset in the byte array the value read



readSwappedShort
public static short readSwappedShort(InputStream input) throws IOException(Code)
Reads a "short" value from an InputStream. The value is converted to the opposed endian system while reading.
Parameters:
  input - source InputStream the value just read
throws:
  IOException - in case of an I/O problem



readSwappedUnsignedInteger
public static long readSwappedUnsignedInteger(byte[] data, int offset)(Code)
Reads an unsigned integer (32-bit) value from a byte array at a given offset. The value is converted to the opposed endian system while reading.
Parameters:
  data - source byte array
Parameters:
  offset - starting offset in the byte array the value read



readSwappedUnsignedInteger
public static long readSwappedUnsignedInteger(InputStream input) throws IOException(Code)
Reads a unsigned integer (32-bit) from an InputStream. The value is converted to the opposed endian system while reading.
Parameters:
  input - source InputStream the value just read
throws:
  IOException - in case of an I/O problem



readSwappedUnsignedShort
public static int readSwappedUnsignedShort(byte[] data, int offset)(Code)
Reads an unsigned short (16-bit) value from a byte array at a given offset. The value is converted to the opposed endian system while reading.
Parameters:
  data - source byte array
Parameters:
  offset - starting offset in the byte array the value read



readSwappedUnsignedShort
public static int readSwappedUnsignedShort(InputStream input) throws IOException(Code)
Reads a unsigned short (16-bit) from an InputStream. The value is converted to the opposed endian system while reading.
Parameters:
  input - source InputStream the value just read
throws:
  IOException - in case of an I/O problem



swapDouble
public static double swapDouble(double value)(Code)
Converts a "double" value between endian systems.
Parameters:
  value - value to convert the converted value



swapFloat
public static float swapFloat(float value)(Code)
Converts a "float" value between endian systems.
Parameters:
  value - value to convert the converted value



swapInteger
public static int swapInteger(int value)(Code)
Converts a "int" value between endian systems.
Parameters:
  value - value to convert the converted value



swapLong
public static long swapLong(long value)(Code)
Converts a "long" value between endian systems.
Parameters:
  value - value to convert the converted value



swapShort
public static short swapShort(short value)(Code)
Converts a "short" value between endian systems.
Parameters:
  value - value to convert the converted value



writeSwappedDouble
public static void writeSwappedDouble(byte[] data, int offset, double value)(Code)
Writes a "double" value to a byte array at a given offset. The value is converted to the opposed endian system while writing.
Parameters:
  data - target byte array
Parameters:
  offset - starting offset in the byte array
Parameters:
  value - value to write



writeSwappedDouble
public static void writeSwappedDouble(OutputStream output, double value) throws IOException(Code)
Writes a "double" value to an OutputStream. The value is converted to the opposed endian system while writing.
Parameters:
  output - target OutputStream
Parameters:
  value - value to write
throws:
  IOException - in case of an I/O problem



writeSwappedFloat
public static void writeSwappedFloat(byte[] data, int offset, float value)(Code)
Writes a "float" value to a byte array at a given offset. The value is converted to the opposed endian system while writing.
Parameters:
  data - target byte array
Parameters:
  offset - starting offset in the byte array
Parameters:
  value - value to write



writeSwappedFloat
public static void writeSwappedFloat(OutputStream output, float value) throws IOException(Code)
Writes a "float" value to an OutputStream. The value is converted to the opposed endian system while writing.
Parameters:
  output - target OutputStream
Parameters:
  value - value to write
throws:
  IOException - in case of an I/O problem



writeSwappedInteger
public static void writeSwappedInteger(byte[] data, int offset, int value)(Code)
Writes a "int" value to a byte array at a given offset. The value is converted to the opposed endian system while writing.
Parameters:
  data - target byte array
Parameters:
  offset - starting offset in the byte array
Parameters:
  value - value to write



writeSwappedInteger
public static void writeSwappedInteger(OutputStream output, int value) throws IOException(Code)
Writes a "int" value to an OutputStream. The value is converted to the opposed endian system while writing.
Parameters:
  output - target OutputStream
Parameters:
  value - value to write
throws:
  IOException - in case of an I/O problem



writeSwappedLong
public static void writeSwappedLong(byte[] data, int offset, long value)(Code)
Writes a "long" value to a byte array at a given offset. The value is converted to the opposed endian system while writing.
Parameters:
  data - target byte array
Parameters:
  offset - starting offset in the byte array
Parameters:
  value - value to write



writeSwappedLong
public static void writeSwappedLong(OutputStream output, long value) throws IOException(Code)
Writes a "long" value to an OutputStream. The value is converted to the opposed endian system while writing.
Parameters:
  output - target OutputStream
Parameters:
  value - value to write
throws:
  IOException - in case of an I/O problem



writeSwappedShort
public static void writeSwappedShort(byte[] data, int offset, short value)(Code)
Writes a "short" value to a byte array at a given offset. The value is converted to the opposed endian system while writing.
Parameters:
  data - target byte array
Parameters:
  offset - starting offset in the byte array
Parameters:
  value - value to write



writeSwappedShort
public static void writeSwappedShort(OutputStream output, short value) throws IOException(Code)
Writes a "short" value to an OutputStream. The value is converted to the opposed endian system while writing.
Parameters:
  output - target OutputStream
Parameters:
  value - value to write
throws:
  IOException - in case of an I/O problem



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.