Java Doc for LittleEndian.java in  » Collaboration » poi-3.0.2-beta2 » org » apache » poi » util » 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 » Collaboration » poi 3.0.2 beta2 » org.apache.poi.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.poi.util.LittleEndian

LittleEndian
public class LittleEndian implements LittleEndianConsts(Code)
a utility class for handling little-endian numbers, which the 80x86 world is replete with. The methods are all static, and input/output is from/to byte arrays, or from InputStreams.
author:
   Marc Johnson (mjohnson at apache dot org)
author:
   Andrew Oliver (acoliver at apache dot org)

Inner Class :public static class BufferUnderrunException extends IOException



Method Summary
public static  byte[]getByteArray(byte[] data, int offset, int size)
     Copy a portion of a byte array
Parameters:
  data - the original byte array
Parameters:
  offset - Where to start copying from.
Parameters:
  size - Number of bytes to copy.
public static  doublegetDouble(byte[] data, int offset)
    
public static  doublegetDouble(byte[] data)
    
public static  intgetInt(byte[] data, int offset)
    
public static  intgetInt(byte[] data)
    
public static  longgetLong(byte[] data, int offset)
    
public static  longgetLong(byte[] data)
    
public static  shortgetShort(byte[] data, int offset)
    
public static  shortgetShort(byte[] data)
    
public static  short[]getShortArray(byte[] data, int offset)
     get a short array from a byte array.
public static  short[]getSimpleShortArray(byte[] data, int offset, int size)
     get a short array from a byte array.
public static  longgetUInt(byte[] data, int offset)
    
public static  longgetUInt(byte[] data)
    
public static  longgetULong(byte[] data, int offset)
    
public static  intgetUShort(byte[] data, int offset)
    
public static  intgetUShort(byte[] data)
    
public static  intgetUnsignedByte(byte[] data, int offset)
     get the unsigned value of a byte.
Parameters:
  data - the byte array.
Parameters:
  offset - a starting offset into the byte array.
public static  intgetUnsignedByte(byte[] data)
     get the unsigned value of a byte.
public static  voidputDouble(byte[] data, int offset, double value)
    
public static  voidputDouble(byte[] data, double value)
    
public static  voidputInt(byte[] data, int offset, int value)
    
public static  voidputInt(byte[] data, int value)
    
public static  voidputLong(byte[] data, int offset, long value)
    
public static  voidputLong(byte[] data, long value)
    
public static  voidputShort(byte[] data, int offset, short value)
    
public static  voidputShort(byte[] data, short value)
    
public static  voidputShortArray(byte[] data, int offset, short[] value)
    
public static  voidputUShort(byte[] data, int offset, int value)
    
public static  byte[]readFromStream(InputStream stream, int size)
     Read the appropriate number of bytes from the stream and return them to the caller.
public static  intreadInt(InputStream stream)
    
public static  longreadLong(InputStream stream)
    
public static  shortreadShort(InputStream stream)
    
public static  intubyteToInt(byte b)
     Convert an 'unsigned' byte to an integer.



Method Detail
getByteArray
public static byte[] getByteArray(byte[] data, int offset, int size)(Code)
Copy a portion of a byte array
Parameters:
  data - the original byte array
Parameters:
  offset - Where to start copying from.
Parameters:
  size - Number of bytes to copy. The byteArray value
throws:
  IndexOutOfBoundsException - - if copying would cause access ofdata outside array bounds.



getDouble
public static double getDouble(byte[] data, int offset)(Code)
get a double value from a byte array, reads it in little endian format then converts the resulting revolting IEEE 754 (curse them) floating point number to a happy java double
Parameters:
  data - the byte array
Parameters:
  offset - a starting offset into the byte array the double (64-bit) value



getDouble
public static double getDouble(byte[] data)(Code)
get a double value from the beginning of a byte array
Parameters:
  data - the byte array the double (64-bit) value



getInt
public static int getInt(byte[] data, int offset)(Code)
get an int value from a byte array
Parameters:
  data - the byte array
Parameters:
  offset - a starting offset into the byte array the int (32-bit) value



getInt
public static int getInt(byte[] data)(Code)
get an int value from the beginning of a byte array
Parameters:
  data - the byte array the int (32-bit) value



getLong
public static long getLong(byte[] data, int offset)(Code)
get a long value from a byte array
Parameters:
  data - the byte array
Parameters:
  offset - a starting offset into the byte array the long (64-bit) value



getLong
public static long getLong(byte[] data)(Code)
get a long value from the beginning of a byte array
Parameters:
  data - the byte array the long (64-bit) value



getShort
public static short getShort(byte[] data, int offset)(Code)
get a short value from a byte array
Parameters:
  data - the byte array
Parameters:
  offset - a starting offset into the byte array the short (16-bit) value



getShort
public static short getShort(byte[] data)(Code)
get a short value from the beginning of a byte array
Parameters:
  data - the byte array the short (16-bit) value



getShortArray
public static short[] getShortArray(byte[] data, int offset)(Code)
get a short array from a byte array. The short array is assumed to start with a word describing the length of the array.
Parameters:
  data - Description of the Parameter
Parameters:
  offset - Description of the Parameter The shortArray value



getSimpleShortArray
public static short[] getSimpleShortArray(byte[] data, int offset, int size)(Code)
get a short array from a byte array.
Parameters:
  data - Description of the Parameter
Parameters:
  offset - Description of the Parameter
Parameters:
  size - Description of the Parameter The simpleShortArray value



getUInt
public static long getUInt(byte[] data, int offset)(Code)
get an unsigned int value from a byte array
Parameters:
  data - the byte array
Parameters:
  offset - a starting offset into the byte array the unsigned int (32-bit) value in a long



getUInt
public static long getUInt(byte[] data)(Code)
get an unsigned int value from a byte array
Parameters:
  data - the byte array the unsigned int (32-bit) value in a long



getULong
public static long getULong(byte[] data, int offset)(Code)

Gets an unsigned int value (8 bytes) from a byte array.


Parameters:
  data - the byte array
Parameters:
  offset - a starting offset into the byte array the unsigned int (32-bit) value in a long



getUShort
public static int getUShort(byte[] data, int offset)(Code)
get an unsigned short value from a byte array
Parameters:
  data - the byte array
Parameters:
  offset - a starting offset into the byte array the unsigned short (16-bit) value in an integer



getUShort
public static int getUShort(byte[] data)(Code)
get an unsigned short value from the beginning of a byte array
Parameters:
  data - the byte array the unsigned short (16-bit) value in an int



getUnsignedByte
public static int getUnsignedByte(byte[] data, int offset)(Code)
get the unsigned value of a byte.
Parameters:
  data - the byte array.
Parameters:
  offset - a starting offset into the byte array. the unsigned value of the byte as a 32 bit integer



getUnsignedByte
public static int getUnsignedByte(byte[] data)(Code)
get the unsigned value of a byte.
Parameters:
  data - the byte array the unsigned value of the byte as a 32 bit integer



putDouble
public static void putDouble(byte[] data, int offset, double value)(Code)
put a double value into a byte array
Parameters:
  data - the byte array
Parameters:
  offset - a starting offset into the byte array
Parameters:
  value - the double (64-bit) value



putDouble
public static void putDouble(byte[] data, double value)(Code)
put a double value into beginning of a byte array
Parameters:
  data - the byte array
Parameters:
  value - the double (64-bit) value



putInt
public static void putInt(byte[] data, int offset, int value)(Code)
put an int value into a byte array
Parameters:
  data - the byte array
Parameters:
  offset - a starting offset into the byte array
Parameters:
  value - the int (32-bit) value



putInt
public static void putInt(byte[] data, int value)(Code)
put an int value into beginning of a byte array
Parameters:
  data - the byte array
Parameters:
  value - the int (32-bit) value



putLong
public static void putLong(byte[] data, int offset, long value)(Code)
put a long value into a byte array
Parameters:
  data - the byte array
Parameters:
  offset - a starting offset into the byte array
Parameters:
  value - the long (64-bit) value



putLong
public static void putLong(byte[] data, long value)(Code)
put a long value into beginning of a byte array
Parameters:
  data - the byte array
Parameters:
  value - the long (64-bit) value



putShort
public static void putShort(byte[] data, int offset, short value)(Code)
put a short value into a byte array
Parameters:
  data - the byte array
Parameters:
  offset - a starting offset into the byte array
Parameters:
  value - the short (16-bit) value



putShort
public static void putShort(byte[] data, short value)(Code)
put a short value into beginning of a byte array
Parameters:
  data - the byte array
Parameters:
  value - the short (16-bit) value



putShortArray
public static void putShortArray(byte[] data, int offset, short[] value)(Code)
put a array of shorts into a byte array
Parameters:
  data - the byte array
Parameters:
  offset - a starting offset into the byte array
Parameters:
  value - the short array



putUShort
public static void putUShort(byte[] data, int offset, int value)(Code)
put an unsigned short value into a byte array
Parameters:
  data - the byte array
Parameters:
  offset - a starting offset into the byte array
Parameters:
  value - the short (16-bit) value
exception:
  ArrayIndexOutOfBoundsException - may be thrown



readFromStream
public static byte[] readFromStream(InputStream stream, int size) throws IOException, BufferUnderrunException(Code)
Read the appropriate number of bytes from the stream and return them to the caller.

However, for the purposes of the POI project, this risk is deemed negligible. It is, however, so noted.
Parameters:
  stream - the InputStream we're reading from
Parameters:
  size - the number of bytes to read; in99.99% of cases, this will be SHORT_SIZE, INT_SIZE, or LONG_SIZE --but it doesn't have to be. the byte array containing therequired number of bytes. The array will contain all zero's on endof stream
exception:
  IOException - will be propagated back to the caller
exception:
  BufferUnderrunException - if the stream cannot provide enoughbytes




readInt
public static int readInt(InputStream stream) throws IOException, BufferUnderrunException(Code)
get an int value from an InputStream
Parameters:
  stream - the InputStream from which the int isto be read the int (32-bit) value
exception:
  IOException - will be propagated back to the caller
exception:
  BufferUnderrunException - if the stream cannot provide enoughbytes



readLong
public static long readLong(InputStream stream) throws IOException, BufferUnderrunException(Code)
get a long value from an InputStream
Parameters:
  stream - the InputStream from which the longis to be read the long (64-bit) value
exception:
  IOException - will be propagated back to the caller
exception:
  BufferUnderrunException - if the stream cannot provide enoughbytes



readShort
public static short readShort(InputStream stream) throws IOException, BufferUnderrunException(Code)
get a short value from an InputStream
Parameters:
  stream - the InputStream from which the shortis to be read the short (16-bit) value
exception:
  IOException - will be propagated back to the caller
exception:
  BufferUnderrunException - if the stream cannot provide enoughbytes



ubyteToInt
public static int ubyteToInt(byte b)(Code)
Convert an 'unsigned' byte to an integer. ie, don't carry across the sign.
Parameters:
  b - Description of the Parameter Description of the Return Value



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.