Java Doc for SerialBlob.java in  » 6.0-JDK-Core » sql » javax » sql » rowset » serial » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
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
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » sql » javax.sql.rowset.serial 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.sql.rowset.serial.SerialBlob

SerialBlob
public class SerialBlob implements Blob,Serializable,Cloneable(Code)
A serialized mapping in the Java programming language of an SQL BLOB value.

The SerialBlob class provides a constructor for creating an instance from a Blob object. Note that the Blob object should have brought the SQL BLOB value's data over to the client before a SerialBlob object is constructed from it. The data of an SQL BLOB value can be materialized on the client as an array of bytes (using the method Blob.getBytes) or as a stream of uninterpreted bytes (using the method Blob.getBinaryStream).

SerialBlob methods make it possible to make a copy of a SerialBlob object as an array of bytes or as a stream. They also make it possible to locate a given pattern of bytes or a Blob object within a SerialBlob object and to update or truncate a Blob object.
author:
   Jonathan Bruce



Field Summary
final static  longserialVersionUID
     The identifier that assists in the serialization of this SerialBlob object.

Constructor Summary
public  SerialBlob(byte[] b)
     Constructs a SerialBlob object that is a serialized version of the given byte array.
public  SerialBlob(Blob blob)
     Constructs a SerialBlob object that is a serialized version of the given Blob object.

Method Summary
public  voidfree()
     This method frees the Blob object and releases the resources that it holds. Blob object.
public  java.io.InputStreamgetBinaryStream()
     Returns this SerialBlob object as an input stream.
public  InputStreamgetBinaryStream(long pos, long length)
     Returns an InputStream object that contains a partial Blob value, starting with the byte specified by pos, which is length bytes in length.
public  byte[]getBytes(long pos, int length)
     Copies the specified number of bytes, starting at the given position, from this SerialBlob object to another array of bytes.
public  longlength()
     Retrieves the number of bytes in this SerialBlob object's array of bytes.
public  longposition(byte[] pattern, long start)
    
public  longposition(Blob pattern, long start)
    
public  java.io.OutputStreamsetBinaryStream(long pos)
     Retrieves a stream that can be used to write to the BLOB value that this Blob object represents.
public  intsetBytes(long pos, byte[] bytes)
     Writes the given array of bytes to the BLOB value that this Blob object represents, starting at position pos, and returns the number of bytes written.
Parameters:
  pos - the position in the SQL BLOB value at whichto start writing.
public  intsetBytes(long pos, byte[] bytes, int offset, int length)
     Writes all or part of the given byte array to the BLOB value that this Blob object represents and returns the number of bytes written. Writing starts at position pos in the BLOB value; len bytes from the given byte array are written.
Parameters:
  pos - the position in the BLOB object at whichto start writing.
public  voidtruncate(long length)
     Truncates the BLOB value that this Blob object represents to be len bytes in length.

Field Detail
serialVersionUID
final static long serialVersionUID(Code)
The identifier that assists in the serialization of this SerialBlob object.




Constructor Detail
SerialBlob
public SerialBlob(byte[] b) throws SerialException, SQLException(Code)
Constructs a SerialBlob object that is a serialized version of the given byte array.

The new SerialBlob object is initialized with the data from the byte array, thus allowing disconnected RowSet objects to establish serialized Blob objects without touching the data source.
Parameters:
  b - the byte array containing the data for the Blob object to be serialized
throws:
  SerialException - if an error occurs during serialization
throws:
  SQLException - if a SQL errors occurs




SerialBlob
public SerialBlob(Blob blob) throws SerialException, SQLException(Code)
Constructs a SerialBlob object that is a serialized version of the given Blob object.

The new SerialBlob object is initialized with the data from the Blob object; therefore, the Blob object should have previously brought the SQL BLOB value's data over to the client from the database. Otherwise, the new SerialBlob object will contain no data.
Parameters:
  blob - the Blob object from which thisSerialBlob object is to be constructed;cannot be null.
throws:
  SerialException - if an error occurs during serialization
throws:
  SQLException - if the Blob passed to thisto this constructor is a null.
See Also:   java.sql.Blob
See Also:   





Method Detail
free
public void free() throws SQLException(Code)
This method frees the Blob object and releases the resources that it holds. Blob object. The object is invalid once the free method is called. If free is called multiple times, the subsequent calls to free are treated as a no-op.
throws:
  SQLException - if an error occurs releasing the Blob's resources
since:
   1.6



getBinaryStream
public java.io.InputStream getBinaryStream() throws SerialException(Code)
Returns this SerialBlob object as an input stream. Unlike the related method, setBinaryStream, a stream is produced regardless of whether the SerialBlob was created with a Blob object or a byte array. a java.io.InputStream object that containsthis SerialBlob object's array of bytes
throws:
  SerialException - if an error occurs
See Also:   SerialBlob.setBinaryStream



getBinaryStream
public InputStream getBinaryStream(long pos, long length) throws SQLException(Code)
Returns an InputStream object that contains a partial Blob value, starting with the byte specified by pos, which is length bytes in length.
Parameters:
  pos - the offset to the first byte of the partial value to be retrieved.The first byte in the Blob is at position 1
Parameters:
  length - the length in bytes of the partial value to be retrieved InputStream through which the partial Blob value can be read.
throws:
  SQLException - if pos is less than 1 or if pos is greater than the number of bytesin the Blob or if pos + length is greater than the number of bytes in the Blob
since:
   1.6



getBytes
public byte[] getBytes(long pos, int length) throws SerialException(Code)
Copies the specified number of bytes, starting at the given position, from this SerialBlob object to another array of bytes.

Note that if the given number of bytes to be copied is larger than the length of this SerialBlob object's array of bytes, the given number will be shortened to the array's length.
Parameters:
  pos - the ordinal position of the first byte in thisSerialBlob object to be copied;numbering starts at 1; must not be less than 1 and must be less than or equalto the length of this SerialBlob object
Parameters:
  length - the number of bytes to be copied an array of bytes that is a copy of a region of thisSerialBlob object, starting at the givenposition and containing the given number of consecutive bytes
throws:
  SerialException - if the given starting position is out of bounds




length
public long length() throws SerialException(Code)
Retrieves the number of bytes in this SerialBlob object's array of bytes. a long indicating the length in bytes of thisSerialBlob object's array of bytes
throws:
  SerialException - if an error occurs



position
public long position(byte[] pattern, long start) throws SerialException, SQLException(Code)
Returns the position in this SerialBlob object where the given pattern of bytes begins, starting the search at the specified position.
Parameters:
  pattern - the pattern of bytes for which to search
Parameters:
  start - the position of the byte in this SerialBlob object from which to begin the search; the first position is 1; must not be less than 1 nor greater than the length of this SerialBlob object the position in this SerialBlob object where the given pattern begins, starting at the specified position; -1 if the pattern is not foundor the given starting position is out of bounds; positionnumbering for the return value starts at 1
throws:
  SerialException - if an error occurs when serializing the blob
throws:
  SQLException - if there is an error accessing the BLOBvalue from the database



position
public long position(Blob pattern, long start) throws SerialException, SQLException(Code)
Returns the position in this SerialBlob object where the given Blob object begins, starting the search at the specified position.
Parameters:
  pattern - the Blob object for which to search;
Parameters:
  start - the position of the byte in this SerialBlob object from which to begin the search; the first position is 1; must not be less than 1 nor greater than the length of this SerialBlob object the position in this SerialBlob object where the given Blob object begins, starting at the specified position; -1 if the pattern is not found or the given starting position is out of bounds; position numbering for the return value starts at 1
throws:
  SerialException - if an error occurs when serializing the blob
throws:
  SQLException - if there is an error accessing the BLOBvalue from the database



setBinaryStream
public java.io.OutputStream setBinaryStream(long pos) throws SerialException, SQLException(Code)
Retrieves a stream that can be used to write to the BLOB value that this Blob object represents. The stream begins at position pos. This method forwards the setBinaryStream() call to the underlying Blob in the event that this SerialBlob object is instantiated with a Blob. If this SerialBlob is instantiated with a byte array, a SerialException is thrown.
Parameters:
  pos - the position in the BLOB value at whichto start writing a java.io.OutputStream object to which data can be written
throws:
  SQLException - if there is an error accessing theBLOB value
throws:
  SerialException - if the SerialBlob in not instantiated with a Blob object that supports setBinaryStream()
See Also:   SerialBlob.getBinaryStream



setBytes
public int setBytes(long pos, byte[] bytes) throws SerialException, SQLException(Code)
Writes the given array of bytes to the BLOB value that this Blob object represents, starting at position pos, and returns the number of bytes written.
Parameters:
  pos - the position in the SQL BLOB value at whichto start writing. The first position is 1; must not be less than 1 nor greater than the length of this SerialBlob object.
Parameters:
  bytes - the array of bytes to be written to the BLOBvalue that this Blob object represents the number of bytes written
throws:
  SerialException - if there is an error accessing theBLOB value; or if an invalid position is set; if an invalid offset value is set
throws:
  SQLException - if there is an error accessing the BLOBvalue from the database
See Also:   SerialBlob.getBytes



setBytes
public int setBytes(long pos, byte[] bytes, int offset, int length) throws SerialException, SQLException(Code)
Writes all or part of the given byte array to the BLOB value that this Blob object represents and returns the number of bytes written. Writing starts at position pos in the BLOB value; len bytes from the given byte array are written.
Parameters:
  pos - the position in the BLOB object at whichto start writing. The first position is 1; must not be less than 1 nor greater than the length of this SerialBlob object.
Parameters:
  bytes - the array of bytes to be written to the BLOBvalue
Parameters:
  offset - the offset in the byte array at whichto start reading the bytes. The first offset position is0; must not be less than 0 nor greaterthan the length of the byte array
Parameters:
  length - the number of bytes to be written to the BLOB value from the array of bytes bytes. the number of bytes written
throws:
  SerialException - if there is an error accessing the BLOB value; if an invalid position is set; if an invalid offset value is set; if number of bytes to be writtenis greater than the SerialBlob length; or the combinedvalues of the length and offset is greater than the Blob buffer
throws:
  SQLException - if there is an error accessing the BLOBvalue from the database.
See Also:   SerialBlob.getBytes



truncate
public void truncate(long length) throws SerialException(Code)
Truncates the BLOB value that this Blob object represents to be len bytes in length.
Parameters:
  length - the length, in bytes, to which the BLOBvalue that this Blob object represents should be truncated
throws:
  SerialException - if there is an error accessing the Blob value;or the length to truncate is greater that the SerialBlob length



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.