Java Doc for CompressedNumber.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » iapi » services » 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 » Database DBMS » db derby 10.2 » org.apache.derby.iapi.services.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.iapi.services.io.CompressedNumber

CompressedNumber
abstract public class CompressedNumber (Code)
Static methods to write and read compressed forms of numbers to DataOut and DataIn interfaces. Format written is platform independent like the Data* interfaces and must remain fixed once a product is shipped. If a different format is required then write a new set of methods, e.g. writeInt2. The formats defined by stored format identifiers are implicitly dependent on these formats not changing.


Field Summary
final public static  intMAX_COMPRESSED_INT_ONE_BYTE
    
final public static  intMAX_COMPRESSED_INT_TWO_BYTES
    
final public static  intMAX_INT_STORED_SIZE
    
final public static  intMAX_LONG_STORED_SIZE
    


Method Summary
public static  voidmain(String[] args)
    
final public static  intreadInt(DataInput in)
     Read an integer previously written by writeInt().
final public static  intreadInt(InputStream in)
     Read an integer previously written by writeInt().
final public static  intreadInt(byte[] data, int offset)
    
final public static  intreadIntAndReturnIntPlusOverhead(byte[] data, int offset)
     Return the compressed Int value + stored size of the length + 1

Given offset in array to beginning of compressed int, return the value of the compressed int + the number of bytes used to store the length.

So 1 byte lengths will return: length + 1 + 1 So 2 byte lengths will return: length + 2 + 1 So 4 byte lengths will return: length + 4 + 1

Note that this routine will not work for lengths MAX_INT - (MAX_INT - 5).

This routine is currently used by the StorePage code to skip fields as efficiently as possible.

final public static  longreadLong(DataInput in)
     Read a long previously written by writeLong().
final public static  longreadLong(InputStream in)
     Read a long previously written by writeLong().
final public static  longreadLong(byte[] data, int offset)
    
final public static  intsizeInt(int value)
    
final public static  intsizeLong(long value)
    
final public static  intskipInt(DataInput in)
     Skip an integer previously written by writeInt().
final public static  intskipInt(InputStream in)
     Skip an integer previously written by writeInt().
final public static  intskipLong(DataInput in)
     Skip a long previously written by writeLong().
final public static  intskipLong(InputStream in)
     Skip a long previously written by writeLong().
final public static  intwriteInt(DataOutput out, int value)
     Write a compressed integer only supporting signed values.
final public static  intwriteInt(OutputStream out, int value)
     Write a compressed integer directly to an OutputStream.
final public static  intwriteLong(DataOutput out, long value)
     Write a compressed long only supporting signed values.
final public static  intwriteLong(OutputStream out, long value)
     Write a compressed integer only supporting signed values.

Field Detail
MAX_COMPRESSED_INT_ONE_BYTE
final public static int MAX_COMPRESSED_INT_ONE_BYTE(Code)



MAX_COMPRESSED_INT_TWO_BYTES
final public static int MAX_COMPRESSED_INT_TWO_BYTES(Code)



MAX_INT_STORED_SIZE
final public static int MAX_INT_STORED_SIZE(Code)



MAX_LONG_STORED_SIZE
final public static int MAX_LONG_STORED_SIZE(Code)





Method Detail
main
public static void main(String[] args) throws IOException(Code)



readInt
final public static int readInt(DataInput in) throws IOException(Code)
Read an integer previously written by writeInt().
exception:
  IOException - an exception was thrown by a method on in.



readInt
final public static int readInt(InputStream in) throws IOException(Code)
Read an integer previously written by writeInt().
exception:
  IOException - an exception was thrown by a method on in.



readInt
final public static int readInt(byte[] data, int offset)(Code)



readIntAndReturnIntPlusOverhead
final public static int readIntAndReturnIntPlusOverhead(byte[] data, int offset)(Code)
Return the compressed Int value + stored size of the length + 1

Given offset in array to beginning of compressed int, return the value of the compressed int + the number of bytes used to store the length.

So 1 byte lengths will return: length + 1 + 1 So 2 byte lengths will return: length + 2 + 1 So 4 byte lengths will return: length + 4 + 1

Note that this routine will not work for lengths MAX_INT - (MAX_INT - 5).

This routine is currently used by the StorePage code to skip fields as efficiently as possible. Since the page size is less than (MAX_INT - 5) it is all right to use this routine. compressed int value + length used to store the length.
Parameters:
  data - byte array containing the field.
Parameters:
  offset - offset to beginning of field, ie. data[offset] contains1st byte of the compressed int.




readLong
final public static long readLong(DataInput in) throws IOException(Code)
Read a long previously written by writeLong().
exception:
  IOException - an exception was thrown by a method on in.



readLong
final public static long readLong(InputStream in) throws IOException(Code)
Read a long previously written by writeLong().
exception:
  IOException - an exception was thrown by a method on in.



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



sizeInt
final public static int sizeInt(int value)(Code)
Return the number of bytes that would be written by a writeInt call



sizeLong
final public static int sizeLong(long value)(Code)



skipInt
final public static int skipInt(DataInput in) throws IOException(Code)
Skip an integer previously written by writeInt().
exception:
  IOException - an exception was thrown by a method on in.



skipInt
final public static int skipInt(InputStream in) throws IOException(Code)
Skip an integer previously written by writeInt().
exception:
  IOException - an exception was thrown by a method on in.



skipLong
final public static int skipLong(DataInput in) throws IOException(Code)
Skip a long previously written by writeLong().
exception:
  IOException - an exception was thrown by a method on in.



skipLong
final public static int skipLong(InputStream in) throws IOException(Code)
Skip a long previously written by writeLong().
exception:
  IOException - an exception was thrown by a method on in.



writeInt
final public static int writeInt(DataOutput out, int value) throws IOException(Code)
Write a compressed integer only supporting signed values. Formats are (with x representing value bits):
 1 Byte - 00xxxxxx                              Represents the value <= 63 (0x3f)
 2 Byte - 01xxxxxx xxxxxxxx                     Represents the value > 63 && <= 16383 (0x3fff)
 4 byte - 1xxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx   Represents the value > 16383 && <= MAX_INT
 

exception:
  IOException - value is negative or an exception was thrown by a method on out.



writeInt
final public static int writeInt(OutputStream out, int value) throws IOException(Code)
Write a compressed integer directly to an OutputStream.
exception:
  IOException - an exception was thrown by a method on in.



writeLong
final public static int writeLong(DataOutput out, long value) throws IOException(Code)
Write a compressed long only supporting signed values. Formats are (with x representing value bits):
 2 byte - 00xxxxxx xxxxxxxx                     Represents the value <= 16383 (0x3fff)
 4 byte - 01xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx   Represents the value > 16383  && <= 0x3fffffff
 8 byte - 1xxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx   Represents the value > 0x3fffffff && <= MAX_LONG
 

exception:
  IOException - value is negative or an exception was thrown by a method on out.



writeLong
final public static int writeLong(OutputStream out, long value) throws IOException(Code)
Write a compressed integer only supporting signed values.
exception:
  IOException - value is negative or an exception was thrown by a method on out.



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.