src/share/classes/javax/sql/rowset/serial/SerialBlob.java

Print this page


   1 /*
   2  * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  34 /**
  35  * A serialized mapping in the Java programming language of an SQL
  36  * <code>BLOB</code> value.
  37  * <P>
  38  * The <code>SerialBlob</code> class provides a constructor for creating
  39  * an instance from a <code>Blob</code> object.  Note that the
  40  * <code>Blob</code>
  41  * object should have brought the SQL <code>BLOB</code> value's data over
  42  * to the client before a <code>SerialBlob</code> object
  43  * is constructed from it.  The data of an SQL <code>BLOB</code> value can
  44  * be materialized on the client as an array of bytes (using the method
  45  * <code>Blob.getBytes</code>) or as a stream of uninterpreted bytes
  46  * (using the method <code>Blob.getBinaryStream</code>).
  47  * <P>
  48  * <code>SerialBlob</code> methods make it possible to make a copy of a
  49  * <code>SerialBlob</code> object as an array of bytes or as a stream.
  50  * They also make it possible to locate a given pattern of bytes or a
  51  * <code>Blob</code> object within a <code>SerialBlob</code> object
  52  * and to update or truncate a <code>Blob</code> object.
  53  *
  54  * <h4> Thread safety </h4>
  55  *
  56  * <p> A SerialBlob is not safe for use by multiple concurrent threads.  If a
  57  * SerialBlob is to be used by more than one thread then access to the SerialBlob
  58  * should be controlled by appropriate synchronization.
  59  *
  60  * @author Jonathan Bruce
  61  */
  62 public class SerialBlob implements Blob, Serializable, Cloneable {
  63 
  64     /**
  65      * A serialized array of uninterpreted bytes representing the
  66      * value of this <code>SerialBlob</code> object.
  67      * @serial
  68      */
  69     private byte buf[];
  70 
  71     /**
  72      * The internal representation of the <code>Blob</code> object on which this
  73      * <code>SerialBlob</code> object is based.
  74      */


   1 /*
   2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  34 /**
  35  * A serialized mapping in the Java programming language of an SQL
  36  * <code>BLOB</code> value.
  37  * <P>
  38  * The <code>SerialBlob</code> class provides a constructor for creating
  39  * an instance from a <code>Blob</code> object.  Note that the
  40  * <code>Blob</code>
  41  * object should have brought the SQL <code>BLOB</code> value's data over
  42  * to the client before a <code>SerialBlob</code> object
  43  * is constructed from it.  The data of an SQL <code>BLOB</code> value can
  44  * be materialized on the client as an array of bytes (using the method
  45  * <code>Blob.getBytes</code>) or as a stream of uninterpreted bytes
  46  * (using the method <code>Blob.getBinaryStream</code>).
  47  * <P>
  48  * <code>SerialBlob</code> methods make it possible to make a copy of a
  49  * <code>SerialBlob</code> object as an array of bytes or as a stream.
  50  * They also make it possible to locate a given pattern of bytes or a
  51  * <code>Blob</code> object within a <code>SerialBlob</code> object
  52  * and to update or truncate a <code>Blob</code> object.
  53  *
  54  * <h3> Thread safety </h3>
  55  *
  56  * <p> A SerialBlob is not safe for use by multiple concurrent threads.  If a
  57  * SerialBlob is to be used by more than one thread then access to the SerialBlob
  58  * should be controlled by appropriate synchronization.
  59  *
  60  * @author Jonathan Bruce
  61  */
  62 public class SerialBlob implements Blob, Serializable, Cloneable {
  63 
  64     /**
  65      * A serialized array of uninterpreted bytes representing the
  66      * value of this <code>SerialBlob</code> object.
  67      * @serial
  68      */
  69     private byte buf[];
  70 
  71     /**
  72      * The internal representation of the <code>Blob</code> object on which this
  73      * <code>SerialBlob</code> object is based.
  74      */