BinaryData.java (hsqldb-2.6.0) | : | BinaryData.java (hsqldb-2.6.1) | ||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
*/ | */ | |||
package org.hsqldb.types; | package org.hsqldb.types; | |||
import java.io.DataInput; | import java.io.DataInput; | |||
import java.io.IOException; | import java.io.IOException; | |||
import java.io.InputStream; | import java.io.InputStream; | |||
import java.util.Arrays; | ||||
import org.hsqldb.SessionInterface; | import org.hsqldb.SessionInterface; | |||
import org.hsqldb.error.Error; | import org.hsqldb.error.Error; | |||
import org.hsqldb.error.ErrorCode; | import org.hsqldb.error.ErrorCode; | |||
import org.hsqldb.lib.ArrayUtil; | import org.hsqldb.lib.ArrayUtil; | |||
/** | /** | |||
* Implementation of BlobData for memory binary data.<p> | * Implementation of BlobData for memory binary data.<p> | |||
* A Binary object instance always wraps a non-null byte[] object. | * A Binary object instance always wraps a non-null byte[] object. | |||
* | * | |||
* @author Fred Toussi (fredt@users dot sourceforge.net) | * @author Fred Toussi (fredt@users dot sourceforge.net) | |||
* @version 2.6.0 | * @version 2.6.1 | |||
* @since 1.7.2 | * @since 1.7.2 | |||
*/ | */ | |||
public class BinaryData implements BlobData { | public class BinaryData implements BlobData { | |||
public static final BinaryData singleBitZero = | public static final BinaryData singleBitZero = | |||
new BinaryData(new byte[]{ 0 }, 1); | new BinaryData(new byte[]{ 0 }, 1); | |||
public static final BinaryData singleBitOne = | public static final BinaryData singleBitOne = | |||
new BinaryData(new byte[]{ -0x80 }, 1); | new BinaryData(new byte[]{ -0x80 }, 1); | |||
public static final byte[] zeroLengthBytes = new byte[0]; | public static final byte[] zeroLengthBytes = new byte[0]; | |||
public static final BinaryData zeroLengthBinary = | public static final BinaryData zeroLengthBinary = | |||
skipping to change at line 86 | skipping to change at line 87 | |||
* This constructor is used inside the engine when an already serialized | * This constructor is used inside the engine when an already serialized | |||
* byte[] is read from a file (.log, .script, .data or text table source). | * byte[] is read from a file (.log, .script, .data or text table source). | |||
* In this case clone is false. | * In this case clone is false. | |||
* | * | |||
* When a byte[] is submitted as a parameter of PreparedStatement then | * When a byte[] is submitted as a parameter of PreparedStatement then | |||
* clone is true. | * clone is true. | |||
*/ | */ | |||
public BinaryData(byte[] data, boolean clone) { | public BinaryData(byte[] data, boolean clone) { | |||
if (clone) { | if (clone) { | |||
data = (byte[]) ArrayUtil.duplicateArray(data); | data = Arrays.copyOf(data, data.length); | |||
} | } | |||
this.data = data; | this.data = data; | |||
this.bitLength = data.length * 8L; | this.bitLength = data.length * 8L; | |||
} | } | |||
public BinaryData(SessionInterface session, BlobData b1, BlobData b2) { | public BinaryData(SessionInterface session, BlobData b1, BlobData b2) { | |||
long length = (b1.length(session) + b2.length(session)); | long length = (b1.length(session) + b2.length(session)); | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 3 lines changed or added |