Java Doc for Blob.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » 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 » ERP CRM Financial » sakai » org.sakaiproject.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.sakaiproject.util.Blob

Blob
public class Blob implements Cloneable,Serializable(Code)
A blob is a Binary Large OBject. The Blob uses a linked list structure internally so it is not susceptible to running out of memory when growing. This can be a problem with very large Vectors -- when they grow, a new, larger internal array is created and elements copied over. Thus, for that short amount of time, there are two copies of the array. That, plus the added overhead of storing bytes in object form, make the Blob the preferrable method for storing raw data.

Since it uses ints as indicies, a single Blob can hold up to Integer.MAX_VALUE (2,147,483,647) bytes. Could be modified to use longs and then could hold up to Long.MAX_VALUE (9.2233e18) bytes if your computer had that much storage. :^)

This is my 'pet' class.
author:
   T. Gee



Field Summary
final public static  intNODE_SIZE
     The default internal data storage node size.
protected transient  BlobNodecurr
    
protected transient  BlobNodeenumerationNode
    
protected transient  intenumerationPos
    
protected transient  BlobNodehead
    
protected  intnodeSize
    
protected transient  intsize
    
protected transient  BlobNodetail
    

Constructor Summary
public  Blob()
     Creates a new, empty Blob.
public  Blob(int nodeSize)
     Creates a new, empty Blob and specifies the default internal node size.
public  Blob(Blob b)
     Creates a new blob that is a copy of an existing blob.
public  Blob(byte arr)
     Creates a new blob and initialized it with a byte array.
public  Blob(byte arr, int startPos, int len)
     Creates a new blob and initialized it with a byte array.

Method Summary
public synchronized  voidappend(byte b)
     Appends a byte to the end of the Blob.
public synchronized  voidappend(char c)
     Appends one byte (in the form of a char) to the end of the Blob.
public synchronized  voidappend(boolean addHighByte, char c)
     Appends one or two bytes (in the form of a char) to the end of the Blob.
public synchronized  voidappend(short s)
     Appends two bytes (in the form of a short) to the end of the Blob.
public synchronized  voidappend(int i)
     Appends four bytes (in the form of an int) to the end of the Blob.
public synchronized  voidappend(long l)
     Appends eight bytes (in the form of a long) to the end of the Blob.
public synchronized  voidappend(float f)
     Appends four bytes (in the form of a float) to the end of the Blob.
public synchronized  voidappend(double d)
     Appends eight bytes (in the form of a double) to the end of the Blob.
public synchronized  voidappend(String s)
     Appends bytes from a String to the end of the Blob.
public synchronized  voidappend(boolean addHighByte, String s)
     Appends bytes from a String to the end of the Blob.
public synchronized  voidappend(byte arr)
     Appends an entire byte array to the end of the Blob.
public synchronized  voidappend(byte arr, int startPos, int len)
     Appends a byte array to the end of the Blob.
public synchronized  voidappend(Blob b)
     Appends the bytes from a Blob to the end of the Blob.
protected  voidappendNode(int newNodeSize)
     Appends a new node to the end of the internal list.
protected synchronized  voidbeginEnumeration(int pos)
     Sets up an enumeration of the bytes of the Blob starting from a particular point.
final protected static  booleanbetween(char test, char low, char high)
     An inclusive between function (for chars).
Parameters:
  test - The char to test.
Parameters:
  low - The lower bound.
Parameters:
  high - The upper bound.
final public static  booleanbetween(int test, int low, int high)
     An inclusive between function (for ints).
Parameters:
  test - The number to test.
Parameters:
  low - The lower bound.
Parameters:
  high - The upper bound.
public synchronized  bytebyteAt(int pos)
     Returns the byte at a specific location.
Parameters:
  pos - The position to from which to return the byte(0 -> beginning).
public synchronized  charcharAt(int pos)
     Returns a character reconstructed from one byte at a specific location. Sets the high byte in the character to 0x0.
Parameters:
  pos - The position to get the byte to reconstuct the character(0 -> beginning).
public synchronized  charcharAt(boolean useHighByte, int pos)
     Returns a character reconstructed from one or two bytes at a specific location.
Parameters:
  useHighByte - 'true' to use two bytes (one for the high byte)to reconstruct a character; 'false' to use one byte and set thehigh byte to 0x0.
Parameters:
  pos - The position to get the byte(s) to reconstuct the character(0 -> beginning).
public synchronized  longchecksum()
     Generates and returns an 8-byte checksum.
public synchronized  Objectclone()
     Clones this Blob.
public synchronized  doubledoubleAt(int pos)
     Returns a double precision floating point number reconstructed from eight bytes at a specific
Parameters:
  pos - The position to get the bytes to reconstuct the double(0 -> beginning).
public synchronized  EnumerationenumerateBytes(int pos)
     Returns an enumeration of the bytes in this Blob.
public synchronized  booleanequals(Object o)
     Returns true if the blob is equal to the given object.
protected  BlobNodefindBefore(BlobNode target)
     Finds the node before the given node.
protected synchronized  floatfloatAt(int pos)
     Returns a floating point number reconstructed from four bytes at a specific location.
Parameters:
  pos - The position to get the bytes to reconstuct the float(0 -> beginning).
public synchronized  BlobgetBlob(int pos, int len)
     Returns a new Blob drawn from bytes at a specific location.
Parameters:
  pos - The position to start retrieving the bytes to buildthe new Blob (0 -> beginning).
Parameters:
  len - The number of bytes to put into the new Blob.
public  byte[]getBytes()
     Gets the bytes of the blob as a byte array.
public synchronized  byte[]getBytes(int start, int len)
     Returns a subset of the bytes of the blob as a byte array.
Parameters:
  start - start index to begin draw (included in get).
Parameters:
  len - number of bytes to extract.
public synchronized  StringgetString()
     Returns a String reconstructed from the bytes of the Blob.
public synchronized  StringgetString(int pos, int len)
     Returns a String reconstructed from bytes at a specific location. Sets the high byte in each character to 0x0.
Parameters:
  pos - The position to start retrieving the bytes to reconstuctthe String (0 -> beginning).
Parameters:
  len - The length of the to-be-returned String.
public synchronized  StringgetString(boolean useHighByte, int pos, int len)
     Returns a String reconstructed from bytes at a specific location.
Parameters:
  useHighByte - 'true' to use two bytes (one for the high byte)to reconstruct each character; 'false' to use one byte and set thehigh byte to 0x0.
Parameters:
  pos - The position to start retrieving the bytes to reconstuctthe String (0 -> beginning).
Parameters:
  len - The length of the to-be-returned String.
protected synchronized  booleanhasMoreBytes()
     Returns 'true' if the Blob has more bytes, 'false' if empty.
final public static  charhexDigit(int i)
     Returns the hex digit cooresponding to a number between 0 and 15.
Parameters:
  i - The number to get the hex digit for.
public synchronized  intindexOf(byte b)
     Searches for a byte and returns an index to the first one found.
Parameters:
  b - The byte to search for.
public synchronized  intindexOf(byte b, int pos)
     Searches for a byte and returns an index to the first one found. Search starts at given index and includes that index.
Parameters:
  b - The byte to search for.
Parameters:
  pos - The position to begin searching at (0 -> beginning).
public  InputStreaminputStream()
    
public synchronized  voidinsertByte(int pos, byte b)
     Inserts a byte into the blob at the position pos.
public synchronized  voidinsertBytes(int pos, byte arr)
     Inserts a byte into the blob at the position pos.
public synchronized  voidinsertBytes(int pos, byte arr, int startPos, int len)
     Inserts a byte into the blob at the position pos.
public synchronized  intintAt(int pos)
     Returns an int reconstructed from four bytes at a specific location.
Parameters:
  pos - The position to get the bytes to reconstuct the int(0 -> beginning).
public synchronized  intlength()
     Gets the number of bytes in the Blob.
public synchronized  longlongAt(int pos)
     Returns a long int reconstructed from eight bytes at a specific location.
Parameters:
  pos - The position to get the bytes to reconstuct the long(0 -> beginning).
protected synchronized  bytenextByte()
     Returns the next byte in the Blob.
public  OutputStreamoutputStream()
    
public synchronized  voidprintContents()
     Prints the contents of this Blob.
public synchronized  intread(int len, InputStream in)
     Reads bytes from an InputStream into the Blob.
Parameters:
  len - The number of bytes to attempt to read.
Parameters:
  in - The InputStream to read from.
public synchronized  intread(InputStream in)
     Reads all bytes from an InputStream into the Blob. This will read an InputStream byte-by-byte until EOF and append the data to the end of the Blob.
Parameters:
  in - The InputStream to read from.
public synchronized  intreadLimiting(InputStream in, long max)
     Reads most bytes from an InputStream into the Blob - not to exceed bytes by much (it may read up to nodeSize more).
protected  voidreadObject(ObjectInputStream in)
     A specialized object read routine.
public synchronized  voidremoveByte(int pos)
     Removes a byte from the Blob at the requested position.
public synchronized  voidremoveBytes(int pos, int len)
     Removes a number of bytes from the Blob at the requested position.
protected  intseek(int pos)
     Seeks a position within the internal list. Takes an offset from the beginning and sets the 'curr' pointer to the reqested node and returns the offset within that node to the correct position.
Parameters:
  pos - The position within the Blob to seek.
public synchronized  voidsetByteAt(int pos, byte b)
     Sets a byte at a particular position.
public synchronized  shortshortAt(int pos)
     Returns a short int reconstructed from two bytes at a specific location.
Parameters:
  pos - The position to get the bytes to reconstuct the short(0 -> beginning).
final public static  Stringspaces(int n)
     Returns a string of a specified number of spaces.
Parameters:
  n - The number of spaces to create.
final public static  Stringstrstr(int n, char c)
     Returns a string of a specified number of a specified character.
Parameters:
  n - The number of characters to create in the return String.
Parameters:
  c - The character to create.
final public static  StringtoHex(byte b)
     Returns a hex representation of a byte.
Parameters:
  b - The byte to convert to hex.
final public static  StringtoHex(short s)
     Returns the hex representation of a short.
Parameters:
  s - The short to convert to hex.
final public static  StringtoHex(int i)
     Returns the hex representation of an int.
Parameters:
  i - The int to convert to hex.
final public static  StringtoHex(long l)
     Returns the hex representation of an long.
Parameters:
  l - The long to convert to hex.
final public static  StringtoHex(String s)
     Returns the hex representation of the characters of a String.
Parameters:
  s - The String to convert to hex.
public synchronized  StringtoString()
     Returns a string representation of the Blob.
public synchronized  voidtruncate(int len)
     Truncates the Blob to the specified position.
public synchronized  voidwrite(OutputStream out)
     Writes the entire contents of the Blob to an OutputStream.
public synchronized  voidwrite(int pos, int len, OutputStream out)
     Writes the contents of a part of the Blob to an OutputStream.
protected  voidwriteObject(ObjectOutputStream out)
     A specialized object write routine. This is because java gets a stack overflow error when trying to write the linked list.

Field Detail
NODE_SIZE
final public static int NODE_SIZE(Code)
The default internal data storage node size.



curr
protected transient BlobNode curr(Code)



enumerationNode
protected transient BlobNode enumerationNode(Code)



enumerationPos
protected transient int enumerationPos(Code)



head
protected transient BlobNode head(Code)



nodeSize
protected int nodeSize(Code)



size
protected transient int size(Code)



tail
protected transient BlobNode tail(Code)




Constructor Detail
Blob
public Blob()(Code)
Creates a new, empty Blob. Uses default internal node size.



Blob
public Blob(int nodeSize)(Code)
Creates a new, empty Blob and specifies the default internal node size.
Parameters:
  growSize - The number of bytes to allocate for a new nodein the internal data storage structure.



Blob
public Blob(Blob b)(Code)
Creates a new blob that is a copy of an existing blob.
Parameters:
  b - The Blob to copy.



Blob
public Blob(byte arr)(Code)
Creates a new blob and initialized it with a byte array.
Parameters:
  arr - A byte array to copy entirely into the new Blob.



Blob
public Blob(byte arr, int startPos, int len)(Code)
Creates a new blob and initialized it with a byte array.
Parameters:
  arr - A byte array to copy into the new Blob.
Parameters:
  startPos - The location to start extracting bytes from.
Parameters:
  len - The length of the array to copy in.




Method Detail
append
public synchronized void append(byte b)(Code)
Appends a byte to the end of the Blob.
Parameters:
  b - The byte to add.



append
public synchronized void append(char c)(Code)
Appends one byte (in the form of a char) to the end of the Blob. Strips the high byte off.
Parameters:
  c - The character to add.



append
public synchronized void append(boolean addHighByte, char c)(Code)
Appends one or two bytes (in the form of a char) to the end of the Blob. Can optionally add the high byte or not.
Parameters:
  addHighByte - 'true' to add the character's high byte to theBlob; 'false' to strip it.
Parameters:
  c - The character to add.



append
public synchronized void append(short s)(Code)
Appends two bytes (in the form of a short) to the end of the Blob.
Parameters:
  s - The short integer to add.



append
public synchronized void append(int i)(Code)
Appends four bytes (in the form of an int) to the end of the Blob.
Parameters:
  i - The integer to add.



append
public synchronized void append(long l)(Code)
Appends eight bytes (in the form of a long) to the end of the Blob.
Parameters:
  l - The long integer to add.



append
public synchronized void append(float f)(Code)
Appends four bytes (in the form of a float) to the end of the Blob.
Parameters:
  f - The float to add.



append
public synchronized void append(double d)(Code)
Appends eight bytes (in the form of a double) to the end of the Blob.
Parameters:
  d - The double to add.



append
public synchronized void append(String s)(Code)
Appends bytes from a String to the end of the Blob. Strips the high bytes from the characters.
Parameters:
  s - The String to add.



append
public synchronized void append(boolean addHighByte, String s)(Code)
Appends bytes from a String to the end of the Blob. Can optionally add the high bytes from the characters or not.
Parameters:
  addHighByte - 'true' to add the characters' high byte to theBlob; 'false' to strip it.
Parameters:
  s - The String to add.



append
public synchronized void append(byte arr)(Code)
Appends an entire byte array to the end of the Blob.
Parameters:
  arr - The array to add bytes from.



append
public synchronized void append(byte arr, int startPos, int len)(Code)
Appends a byte array to the end of the Blob.
Parameters:
  arr - The array to add bytes from.
Parameters:
  startPos - The position to start the byte extractionfrom the array at.
Parameters:
  len - The number of bytes to read from the array.



append
public synchronized void append(Blob b)(Code)
Appends the bytes from a Blob to the end of the Blob.
Parameters:
  b - The Blob to draw bytes from.



appendNode
protected void appendNode(int newNodeSize)(Code)
Appends a new node to the end of the internal list.
Parameters:
  newNodeSize - Size of the new node to create.



beginEnumeration
protected synchronized void beginEnumeration(int pos)(Code)
Sets up an enumeration of the bytes of the Blob starting from a particular point.
Parameters:
  pos - The location from which to begin enumerating bytes.
exception:
  java.lang.IndexOutOfBoundsException - If pos and len areoutside range of Blob.



between
final protected static boolean between(char test, char low, char high)(Code)
An inclusive between function (for chars).
Parameters:
  test - The char to test.
Parameters:
  low - The lower bound.
Parameters:
  high - The upper bound. true if test is between low and high (inclusive),false otherwise.



between
final public static boolean between(int test, int low, int high)(Code)
An inclusive between function (for ints).
Parameters:
  test - The number to test.
Parameters:
  low - The lower bound.
Parameters:
  high - The upper bound. true if test is between low and high (inclusive),false otherwise.



byteAt
public synchronized byte byteAt(int pos)(Code)
Returns the byte at a specific location.
Parameters:
  pos - The position to from which to return the byte(0 -> beginning). The byte at requested position.
exception:
  java.lang.IndexOutOfBoundsException - If pos isoutside range of Blob.



charAt
public synchronized char charAt(int pos)(Code)
Returns a character reconstructed from one byte at a specific location. Sets the high byte in the character to 0x0.
Parameters:
  pos - The position to get the byte to reconstuct the character(0 -> beginning). The reconstructed character.
exception:
  java.lang.IndexOutOfBoundsException - If the requestedchar is outside the Blob.



charAt
public synchronized char charAt(boolean useHighByte, int pos)(Code)
Returns a character reconstructed from one or two bytes at a specific location.
Parameters:
  useHighByte - 'true' to use two bytes (one for the high byte)to reconstruct a character; 'false' to use one byte and set thehigh byte to 0x0.
Parameters:
  pos - The position to get the byte(s) to reconstuct the character(0 -> beginning). The reconstructed character.
exception:
  java.lang.IndexOutOfBoundsException - If the requestedbytes are outside the Blob.



checksum
public synchronized long checksum()(Code)
Generates and returns an 8-byte checksum.



clone
public synchronized Object clone()(Code)
Clones this Blob. The resulting Blob will have the same data as the first. (altho possibly not the same internal configuration).



doubleAt
public synchronized double doubleAt(int pos)(Code)
Returns a double precision floating point number reconstructed from eight bytes at a specific
Parameters:
  pos - The position to get the bytes to reconstuct the double(0 -> beginning). The reconstructed double.
exception:
  java.lang.IndexOutOfBoundsException - If the requestedbytes are outside the Blob.



enumerateBytes
public synchronized Enumeration enumerateBytes(int pos)(Code)
Returns an enumeration of the bytes in this Blob. The objects returned from the calls to nextElement are of type Byte.
Parameters:
  pos - The location from which to begin enumerating bytes.
exception:
  java.lang.IndexOutOfBoundsException - If pos isoutside range of Blob.



equals
public synchronized boolean equals(Object o)(Code)
Returns true if the blob is equal to the given object. True only if supplied object is a Blob and the two contain exactly the same data.



findBefore
protected BlobNode findBefore(BlobNode target)(Code)
Finds the node before the given node. This is the one whose next pointer is the given node. the node before the supplied node ornull if the given node is the head node.
exception:
  java.util.NoSuchElementException - if the node isnot found in the list.



floatAt
protected synchronized float floatAt(int pos)(Code)
Returns a floating point number reconstructed from four bytes at a specific location.
Parameters:
  pos - The position to get the bytes to reconstuct the float(0 -> beginning). The reconstructed float.
exception:
  java.lang.IndexOutOfBoundsException - If the requestedbytes are outside the Blob.



getBlob
public synchronized Blob getBlob(int pos, int len)(Code)
Returns a new Blob drawn from bytes at a specific location.
Parameters:
  pos - The position to start retrieving the bytes to buildthe new Blob (0 -> beginning).
Parameters:
  len - The number of bytes to put into the new Blob. The newly constructed Blob.
exception:
  java.lang.IndexOutOfBoundsException - If the requestedbytes are outside the Blob.



getBytes
public byte[] getBytes()(Code)
Gets the bytes of the blob as a byte array. An array of the bytes that compose the Blob.



getBytes
public synchronized byte[] getBytes(int start, int len)(Code)
Returns a subset of the bytes of the blob as a byte array.
Parameters:
  start - start index to begin draw (included in get).
Parameters:
  len - number of bytes to extract. An array of the bytes that compose the Blob.
exception:
  java.lang.IndexOutOfBoundsException - If start and len areoutside range of Blob.



getString
public synchronized String getString()(Code)
Returns a String reconstructed from the bytes of the Blob. Sets the high byte in each character to 0x0. The reconstructed String.



getString
public synchronized String getString(int pos, int len)(Code)
Returns a String reconstructed from bytes at a specific location. Sets the high byte in each character to 0x0.
Parameters:
  pos - The position to start retrieving the bytes to reconstuctthe String (0 -> beginning).
Parameters:
  len - The length of the to-be-returned String. The reconstructed String.
exception:
  java.lang.IndexOutOfBoundsException - If the requestedbytes are outside the Blob.



getString
public synchronized String getString(boolean useHighByte, int pos, int len)(Code)
Returns a String reconstructed from bytes at a specific location.
Parameters:
  useHighByte - 'true' to use two bytes (one for the high byte)to reconstruct each character; 'false' to use one byte and set thehigh byte to 0x0.
Parameters:
  pos - The position to start retrieving the bytes to reconstuctthe String (0 -> beginning).
Parameters:
  len - The length of the to-be-returned String. The reconstructed String.
exception:
  java.lang.IndexOutOfBoundsException - If the requestedbytes are outside the Blob.



hasMoreBytes
protected synchronized boolean hasMoreBytes()(Code)
Returns 'true' if the Blob has more bytes, 'false' if empty.



hexDigit
final public static char hexDigit(int i)(Code)
Returns the hex digit cooresponding to a number between 0 and 15.
Parameters:
  i - The number to get the hex digit for. The hex digit cooresponding to that number.
exception:
  java.lang.IllegalArgumentException - If supplied digitis not between 0 and 15 inclusive.



indexOf
public synchronized int indexOf(byte b)(Code)
Searches for a byte and returns an index to the first one found.
Parameters:
  b - The byte to search for. The index of the first match or -1 if not found.



indexOf
public synchronized int indexOf(byte b, int pos)(Code)
Searches for a byte and returns an index to the first one found. Search starts at given index and includes that index.
Parameters:
  b - The byte to search for.
Parameters:
  pos - The position to begin searching at (0 -> beginning). The index of the first match or -1 if not found.
exception:
  java.lang.IndexOutOfBoundsException - If pos isoutside range of Blob.



inputStream
public InputStream inputStream()(Code)
provide an input stream that reads the blob contents



insertByte
public synchronized void insertByte(int pos, byte b)(Code)
Inserts a byte into the blob at the position pos. Everything else is moved back.
Parameters:
  pos - The postition to add the byte at (0 -> beginning).
Parameters:
  b - The byte to add.
See Also:   Blob.insertBytes
exception:
  java.lang.IndexOutOfBoundsException - If pos isoutside range of Blob.



insertBytes
public synchronized void insertBytes(int pos, byte arr)(Code)
Inserts a byte into the blob at the position pos. Everything else is moved back.
Parameters:
  pos - The postition to begin adding the bytes at (0 -> beginning).
Parameters:
  arr - The array of bytes to add from.
exception:
  java.lang.IndexOutOfBoundsException - If pos isoutside range of Blob.



insertBytes
public synchronized void insertBytes(int pos, byte arr, int startPos, int len)(Code)
Inserts a byte into the blob at the position pos. Everything else is moved back.
Parameters:
  pos - The postition to begin adding the bytes at (0 -> beginning).
Parameters:
  arr - The array of bytes to add from.
Parameters:
  startPos - The position to begin byte copy from.
Parameters:
  len - The number of bytes to add from the array.
exception:
  java.lang.IndexOutOfBoundsException - If pos isoutside range of Blob.



intAt
public synchronized int intAt(int pos)(Code)
Returns an int reconstructed from four bytes at a specific location.
Parameters:
  pos - The position to get the bytes to reconstuct the int(0 -> beginning). The reconstructed int.
exception:
  java.lang.IndexOutOfBoundsException - If the requestedbytes are outside the Blob.



length
public synchronized int length()(Code)
Gets the number of bytes in the Blob. The number of bytes in the Blob.



longAt
public synchronized long longAt(int pos)(Code)
Returns a long int reconstructed from eight bytes at a specific location.
Parameters:
  pos - The position to get the bytes to reconstuct the long(0 -> beginning). The reconstructed long.
exception:
  java.lang.IndexOutOfBoundsException - If the requestedbytes are outside the Blob.



nextByte
protected synchronized byte nextByte()(Code)
Returns the next byte in the Blob.
exception:
  java.util.NoSuchElementException - If there are no more bytesin the current enumeration



outputStream
public OutputStream outputStream()(Code)
provide an output stream that writes to the END of the blob (appends)



printContents
public synchronized void printContents()(Code)
Prints the contents of this Blob. Formats the data neatly and prints it to System.out.
See Also:   Blob.toString



read
public synchronized int read(int len, InputStream in) throws IOException(Code)
Reads bytes from an InputStream into the Blob.
Parameters:
  len - The number of bytes to attempt to read.
Parameters:
  in - The InputStream to read from. The number of bytes read and appended to the blobor -1 if the end of the stream was reached.
exception:
  java.io.IOException - If there is a problem reading.



read
public synchronized int read(InputStream in) throws IOException(Code)
Reads all bytes from an InputStream into the Blob. This will read an InputStream byte-by-byte until EOF and append the data to the end of the Blob.
Parameters:
  in - The InputStream to read from. The number of bytes read and appended to the blobor -1 if the end of the stream was reached immediately.
exception:
  java.io.IOException - If there is a problem reading.



readLimiting
public synchronized int readLimiting(InputStream in, long max) throws IOException(Code)
Reads most bytes from an InputStream into the Blob - not to exceed bytes by much (it may read up to nodeSize more). This will read an InputStream byte-by-byte until EOF and append the data to the end of the Blob.
Parameters:
  in - The InputStream to read from.
Parameters:
  max - the max (sort of) bytes to read The number of bytes read and appended to the blobor -1 if the end of the stream was reached immediately.or -2 if we cut off due to max before end
exception:
  java.io.IOException - If there is a problem reading.



readObject
protected void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException(Code)
A specialized object read routine.



removeByte
public synchronized void removeByte(int pos)(Code)
Removes a byte from the Blob at the requested position. Everything else is moved up.
Parameters:
  pos - The position to remove a byte from (0 -> beginning).
See Also:   Blob.removeBytes
exception:
  java.lang.IndexOutOfBoundsException - If pos isoutside range of Blob.



removeBytes
public synchronized void removeBytes(int pos, int len)(Code)
Removes a number of bytes from the Blob at the requested position. Everything else is moved up.
Parameters:
  pos - The position to remove the bytes from (0 -> beginning).
Parameters:
  len - The number of bytes to remove.
exception:
  java.lang.IndexOutOfBoundsException - If pos and len areoutside range of Blob.



seek
protected int seek(int pos)(Code)
Seeks a position within the internal list. Takes an offset from the beginning and sets the 'curr' pointer to the reqested node and returns the offset within that node to the correct position.
Parameters:
  pos - The position within the Blob to seek. The offest into the current node where the requestedbyte can be found.
exception:
  java.lang.IndexOutOfBoundsException - If pos isoutside range of Blob.



setByteAt
public synchronized void setByteAt(int pos, byte b)(Code)
Sets a byte at a particular position.
Parameters:
  pos - The position to set the byte at.
Parameters:
  b - The value to set that postion to.
exception:
  java.lang.IndexOutOfBoundsException - If pos isoutside range of Blob.



shortAt
public synchronized short shortAt(int pos)(Code)
Returns a short int reconstructed from two bytes at a specific location.
Parameters:
  pos - The position to get the bytes to reconstuct the short(0 -> beginning). The reconstructed short.
exception:
  java.lang.IndexOutOfBoundsException - If the requestedbytes are outside the Blob.



spaces
final public static String spaces(int n)(Code)
Returns a string of a specified number of spaces.
Parameters:
  n - The number of spaces to create. A String of the requested number of spaces.
See Also:   Blob.strstr



strstr
final public static String strstr(int n, char c)(Code)
Returns a string of a specified number of a specified character.
Parameters:
  n - The number of characters to create in the return String.
Parameters:
  c - The character to create. A String of the requested number of the requested character.



toHex
final public static String toHex(byte b)(Code)
Returns a hex representation of a byte.
Parameters:
  b - The byte to convert to hex. The 2-digit hex value of the supplied byte.



toHex
final public static String toHex(short s)(Code)
Returns the hex representation of a short.
Parameters:
  s - The short to convert to hex. The 4-digit hex value of the supplied short.



toHex
final public static String toHex(int i)(Code)
Returns the hex representation of an int.
Parameters:
  i - The int to convert to hex. The 8-digit hex value of the supplied int.



toHex
final public static String toHex(long l)(Code)
Returns the hex representation of an long.
Parameters:
  l - The long to convert to hex. The 16-digit hex value of the supplied long.



toHex
final public static String toHex(String s)(Code)
Returns the hex representation of the characters of a String.
Parameters:
  s - The String to convert to hex. A String where each character of the original stringis given as a space seperated sequence of hex values.



toString
public synchronized String toString()(Code)
Returns a string representation of the Blob. Includes length and checksum.
See Also:   Blob.printContents



truncate
public synchronized void truncate(int len)(Code)
Truncates the Blob to the specified position. The Blob will have the given number of bytes left.
Parameters:
  len - The size to truncate the Blob to.
exception:
  java.lang.IndexOutOfBoundsException - If len isoutside range of Blob.



write
public synchronized void write(OutputStream out) throws IOException(Code)
Writes the entire contents of the Blob to an OutputStream.
Parameters:
  out - The OutputStream to write to.
exception:
  java.io.IOException - If there is a problem writing.



write
public synchronized void write(int pos, int len, OutputStream out) throws IOException(Code)
Writes the contents of a part of the Blob to an OutputStream.
Parameters:
  pos - The position to begin writing from.
Parameters:
  len - The number of bytes to write.
Parameters:
  out - The OutputStream to write to.
exception:
  java.lang.IndexOutOfBoundsException - If pos and len areoutside range of Blob.
exception:
  java.io.IOException - If there is a problem writing.



writeObject
protected void writeObject(ObjectOutputStream out) throws IOException(Code)
A specialized object write routine. This is because java gets a stack overflow error when trying to write the linked list. Damn!



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.