Mercurial > hg > monetdb-java
annotate src/main/java/org/monetdb/jdbc/MonetBlob.java @ 943:ff075ed5ce81
Spell check.
author | Sjoerd Mullender <sjoerd@acm.org> |
---|---|
date | Thu, 09 Jan 2025 10:56:14 +0100 (3 months ago) |
parents | d416e9b6b3d0 |
children |
rev | line source |
---|---|
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
1 /* |
833
e890195256ac
Update copyright for the new year, move to MonetDB Foundation, add SPDX.
Sjoerd Mullender <sjoerd@acm.org>
parents:
819
diff
changeset
|
2 * SPDX-License-Identifier: MPL-2.0 |
e890195256ac
Update copyright for the new year, move to MonetDB Foundation, add SPDX.
Sjoerd Mullender <sjoerd@acm.org>
parents:
819
diff
changeset
|
3 * |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
4 * This Source Code Form is subject to the terms of the Mozilla Public |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
7 * |
937
d416e9b6b3d0
Update Copyright year.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
833
diff
changeset
|
8 * Copyright 2024, 2025 MonetDB Foundation; |
833
e890195256ac
Update copyright for the new year, move to MonetDB Foundation, add SPDX.
Sjoerd Mullender <sjoerd@acm.org>
parents:
819
diff
changeset
|
9 * Copyright August 2008 - 2023 MonetDB B.V.; |
e890195256ac
Update copyright for the new year, move to MonetDB Foundation, add SPDX.
Sjoerd Mullender <sjoerd@acm.org>
parents:
819
diff
changeset
|
10 * Copyright 1997 - July 2008 CWI. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
11 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
12 |
391
f523727db392
Moved Java classes from packages starting with nl.cwi.monetdb.* to package org.monetdb.*
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
350
diff
changeset
|
13 package org.monetdb.jdbc; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
14 |
69
e092fa8d9ab7
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
15 import java.io.ByteArrayInputStream; |
e092fa8d9ab7
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
16 import java.io.InputStream; |
e092fa8d9ab7
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
17 import java.io.OutputStream; |
e092fa8d9ab7
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
18 import java.sql.Blob; |
e092fa8d9ab7
Expand import java.*.* statements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
0
diff
changeset
|
19 import java.sql.SQLException; |
266
eefa7f625673
Resolve javadoc errors:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
262
diff
changeset
|
20 import java.sql.SQLFeatureNotSupportedException; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
21 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
22 /** |
451
3dfcd06fd8ba
Correcting typos in documentation text. Also improved the readability of the generated javadoc documents.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
23 *<pre> |
209
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
24 * The MonetBlob class implements the {@link java.sql.Blob} interface. |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
25 * |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
26 * Because MonetDB/SQL currently has no support for streams, this class is a |
451
3dfcd06fd8ba
Correcting typos in documentation text. Also improved the readability of the generated javadoc documents.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
27 * shallow wrapper of a byte[]. It is more or less supplied to |
3dfcd06fd8ba
Correcting typos in documentation text. Also improved the readability of the generated javadoc documents.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
28 * enable an application that depends on it to run. It may be obvious |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
29 * that it is a real resource expensive workaround that contradicts the |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
30 * benefits for a Blob: avoidance of huge resource consumption. |
209
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
31 * <b>Use of this class is highly discouraged.</b> |
451
3dfcd06fd8ba
Correcting typos in documentation text. Also improved the readability of the generated javadoc documents.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
32 *</pre> |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
33 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
34 * @author Fabian Groffen |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
35 */ |
209
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
36 public final class MonetBlob implements Blob { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
37 private byte[] buf; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
38 |
329
05c7989eae91
Removed duplicate code for converting a string of hex characters into a byte array, done both in MonetBlob.create() and in MonetResultSet.getBytes().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
316
diff
changeset
|
39 /* constructors */ |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
40 protected MonetBlob(final byte[] data) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
41 buf = data; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
42 } |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
43 |
329
05c7989eae91
Removed duplicate code for converting a string of hex characters into a byte array, done both in MonetBlob.create() and in MonetResultSet.getBytes().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
316
diff
changeset
|
44 protected MonetBlob(final String hexString) { |
05c7989eae91
Removed duplicate code for converting a string of hex characters into a byte array, done both in MonetBlob.create() and in MonetResultSet.getBytes().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
316
diff
changeset
|
45 buf = hexStrToByteArray(hexString); |
05c7989eae91
Removed duplicate code for converting a string of hex characters into a byte array, done both in MonetBlob.create() and in MonetResultSet.getBytes().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
316
diff
changeset
|
46 } |
05c7989eae91
Removed duplicate code for converting a string of hex characters into a byte array, done both in MonetBlob.create() and in MonetResultSet.getBytes().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
316
diff
changeset
|
47 |
05c7989eae91
Removed duplicate code for converting a string of hex characters into a byte array, done both in MonetBlob.create() and in MonetResultSet.getBytes().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
316
diff
changeset
|
48 |
05c7989eae91
Removed duplicate code for converting a string of hex characters into a byte array, done both in MonetBlob.create() and in MonetResultSet.getBytes().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
316
diff
changeset
|
49 /* class utility methods */ |
05c7989eae91
Removed duplicate code for converting a string of hex characters into a byte array, done both in MonetBlob.create() and in MonetResultSet.getBytes().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
316
diff
changeset
|
50 static final byte[] hexStrToByteArray(final String hexString) { |
150
c5309def7d4b
Improve MonetBlob implementation.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
90
diff
changeset
|
51 // unpack the HEX (BLOB) notation to real bytes |
316
d479475888e3
Replace StringBuilder methods sb.delete(0, sb.length()) with faster sb.setLength(0).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
52 final int len = hexString.length() / 2; |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
53 final byte[] buf = new byte[len]; |
150
c5309def7d4b
Improve MonetBlob implementation.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
90
diff
changeset
|
54 for (int i = 0; i < len; i++) { |
316
d479475888e3
Replace StringBuilder methods sb.delete(0, sb.length()) with faster sb.setLength(0).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
55 // was buf[i] = (byte)Integer.parseInt(hexString.substring(2 * i, (2 * i) + 2), 16); |
d479475888e3
Replace StringBuilder methods sb.delete(0, sb.length()) with faster sb.setLength(0).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
56 buf[i] = (byte) ((Character.digit(hexString.charAt(2 * i), 16) << 4) |
d479475888e3
Replace StringBuilder methods sb.delete(0, sb.length()) with faster sb.setLength(0).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
57 + Character.digit(hexString.charAt((2 * i) +1), 16)); |
150
c5309def7d4b
Improve MonetBlob implementation.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
90
diff
changeset
|
58 } |
329
05c7989eae91
Removed duplicate code for converting a string of hex characters into a byte array, done both in MonetBlob.create() and in MonetResultSet.getBytes().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
316
diff
changeset
|
59 return buf; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
60 } |
150
c5309def7d4b
Improve MonetBlob implementation.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
90
diff
changeset
|
61 |
c5309def7d4b
Improve MonetBlob implementation.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
90
diff
changeset
|
62 /* internal utility method */ |
316
d479475888e3
Replace StringBuilder methods sb.delete(0, sb.length()) with faster sb.setLength(0).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
63 private final void checkBufIsNotNull() throws SQLException { |
150
c5309def7d4b
Improve MonetBlob implementation.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
90
diff
changeset
|
64 if (buf == null) |
c5309def7d4b
Improve MonetBlob implementation.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
90
diff
changeset
|
65 throw new SQLException("This MonetBlob has been freed", "M1M20"); |
c5309def7d4b
Improve MonetBlob implementation.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
90
diff
changeset
|
66 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
67 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
68 //== begin interface Blob |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
69 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
70 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
71 * This method frees the Blob object and releases the resources that |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
72 * it holds. The object is invalid once the free method is called. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
73 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
74 * After free has been called, any attempt to invoke a method other |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
75 * than free will result in a SQLException being thrown. If free is |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
76 * called multiple times, the subsequent calls to free are treated |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
77 * as a no-op. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
78 * |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
79 * @throws SQLException if an error occurs releasing the Blob's resources |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
80 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
81 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
82 public void free() throws SQLException { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
83 buf = null; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
84 } |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
85 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
86 /** |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
87 * Retrieves the BLOB value designated by this Blob instance as a stream. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
88 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
89 * @return a stream containing the BLOB data |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
90 * @throws SQLException if there is an error accessing the BLOB value |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
91 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
92 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
93 public InputStream getBinaryStream() throws SQLException { |
150
c5309def7d4b
Improve MonetBlob implementation.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
90
diff
changeset
|
94 checkBufIsNotNull(); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
95 return new ByteArrayInputStream(buf); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
96 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
97 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
98 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
99 * Returns an InputStream object that contains a partial Blob value, |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
100 * starting with the byte specified by pos, which is length bytes in |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
101 * length. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
102 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
103 * @param pos the offset to the first byte of the partial value to |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
104 * be retrieved. The first byte in the Blob is at position 1 |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
105 * @param length the length in bytes of the partial value to be retrieved |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
106 * @return InputStream through which the partial Blob value can be read. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
107 * @throws SQLException if pos is less than 1 or if pos is |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
108 * greater than the number of bytes in the Blob or if pos + |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
109 * length is greater than the number of bytes in the Blob |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
110 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
111 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
112 public InputStream getBinaryStream(final long pos, final long length) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
113 throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
114 { |
150
c5309def7d4b
Improve MonetBlob implementation.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
90
diff
changeset
|
115 checkBufIsNotNull(); |
209
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
116 if (pos < 1 || pos > buf.length) { |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
117 throw new SQLException("Invalid pos value: " + pos, "M1M05"); |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
118 } |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
119 if (length < 0 || pos - 1 + length > buf.length) { |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
120 throw new SQLException("Invalid length value: " + length, "M1M05"); |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
121 } |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
122 return new ByteArrayInputStream(buf, (int) pos - 1, (int) length); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
123 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
124 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
125 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
126 * Retrieves all or part of the BLOB value that this Blob object |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
127 * represents, as an array of bytes. This byte array contains up to |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
128 * length consecutive bytes starting at position pos. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
129 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
130 * @param pos the ordinal position of the first byte in the BLOB |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
131 * value to be extracted; the first byte is at position 1. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
132 * @param length the number of consecutive bytes to be copied |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
133 * @return a byte array containing up to length consecutive bytes |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
134 * from the BLOB value designated by this Blob object, |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
135 * starting with the byte at position pos. |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
136 * @throws SQLException if there is an error accessing the BLOB value |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
137 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
138 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
139 public byte[] getBytes(final long pos, final int length) throws SQLException { |
150
c5309def7d4b
Improve MonetBlob implementation.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
90
diff
changeset
|
140 checkBufIsNotNull(); |
209
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
141 if (pos < 1 || pos > buf.length) { |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
142 throw new SQLException("Invalid pos value: " + pos, "M1M05"); |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
143 } |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
144 if (length < 0 || pos - 1 + length > buf.length) { |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
145 throw new SQLException("Invalid length value: " + length, "M1M05"); |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
146 } |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
147 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
148 try { |
150
c5309def7d4b
Improve MonetBlob implementation.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
90
diff
changeset
|
149 return java.util.Arrays.copyOfRange(buf, (int) pos - 1, (int) pos - 1 + length); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
150 } catch (IndexOutOfBoundsException e) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
151 throw new SQLException(e.getMessage(), "M0M10"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
152 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
153 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
154 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
155 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
156 * Returns the number of bytes in the BLOB value designated by this |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
157 * Blob object. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
158 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
159 * @return length of the BLOB in bytes |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
160 * @throws SQLException if there is an error accessing the length |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
161 * of the BLOB value |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
162 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
163 @Override |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
164 public long length() throws SQLException { |
150
c5309def7d4b
Improve MonetBlob implementation.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
90
diff
changeset
|
165 checkBufIsNotNull(); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
166 return (long)buf.length; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
167 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
168 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
169 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
170 * Retrieves the byte position in the BLOB value designated by this |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
171 * Blob object at which pattern begins. The search begins at position start. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
172 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
173 * @param pattern the Blob object designating the BLOB value for |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
174 * which to search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
175 * @param start the position in the BLOB value at which to begin |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
176 * searching; the first position is 1 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
177 * @return the position at which the pattern begins, else -1 |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
178 * @throws SQLException if there is an error accessing the BLOB value |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
179 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
180 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
181 public long position(final Blob pattern, final long start) throws SQLException { |
209
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
182 if (pattern == null) { |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
183 throw new SQLException("Missing pattern object", "M1M05"); |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
184 } |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
185 // buf and input argument start will be checked in method position(byte{}, long) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
186 return position(pattern.getBytes(1L, (int)pattern.length()), start); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
187 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
188 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
189 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
190 * Retrieves the byte position at which the specified byte array |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
191 * pattern begins within the BLOB value that this Blob object |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
192 * represents. The search for pattern begins at position start. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
193 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
194 * @param pattern the byte array for which to search |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
195 * @param start the position at which to begin searching; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
196 * the first position is 1 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
197 * @return the position at which the pattern appears, else -1 |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
198 * @throws SQLException if there is an error accessing the BLOB value |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
199 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
200 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
201 public long position(final byte[] pattern, final long start) throws SQLException { |
150
c5309def7d4b
Improve MonetBlob implementation.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
90
diff
changeset
|
202 checkBufIsNotNull(); |
209
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
203 if (pattern == null) { |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
204 throw new SQLException("Missing pattern object", "M1M05"); |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
205 } |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
206 if (start < 1 || start > buf.length) { |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
207 throw new SQLException("Invalid start value: " + start, "M1M05"); |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
208 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
209 try { |
209
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
210 final int patternLength = pattern.length; |
316
d479475888e3
Replace StringBuilder methods sb.delete(0, sb.length()) with faster sb.setLength(0).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
211 final int maxPos = buf.length - patternLength; |
d479475888e3
Replace StringBuilder methods sb.delete(0, sb.length()) with faster sb.setLength(0).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
212 for (int i = (int)(start - 1); i < maxPos; i++) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
213 int j; |
209
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
214 for (j = 0; j < patternLength; j++) { |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
215 if (buf[i + j] != pattern[j]) |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
216 break; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
217 } |
209
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
218 if (j == patternLength) |
316
d479475888e3
Replace StringBuilder methods sb.delete(0, sb.length()) with faster sb.setLength(0).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
219 // found a match |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
220 return i; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
221 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
222 } catch (IndexOutOfBoundsException e) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
223 throw new SQLException(e.getMessage(), "M0M10"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
224 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
225 return -1; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
226 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
227 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
228 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
229 * Retrieves a stream that can be used to write to the BLOB value |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
230 * that this Blob object represents. The stream begins at position |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
231 * pos. The bytes written to the stream will overwrite the existing |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
232 * bytes in the Blob object starting at the position pos. If the end |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
233 * of the Blob value is reached while writing to the stream, then |
943 | 234 * the length of the Blob value will be increased to accommodate the |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
235 * extra bytes. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
236 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
237 * @param pos the position in the BLOB value at which to start |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
238 * writing; the first position is 1 |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
239 * @return a java.io.OutputStream object to which data can be written |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
240 * @throws SQLException if there is an error accessing the BLOB |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
241 * value or if pos is less than 1 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
242 * @throws SQLFeatureNotSupportedException if the JDBC driver does |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
243 * not support this method |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
244 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
245 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
246 public OutputStream setBinaryStream(final long pos) throws SQLException { |
262
2d62ca1f758b
Moved utility method newSQLFeatureNotSupportedException(String name) from MonetPreparedStatement.java and MonetResultSet.java
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
261
diff
changeset
|
247 throw MonetWrapper.newSQLFeatureNotSupportedException("setBinaryStream"); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
248 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
249 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
250 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
251 * Writes the given array of bytes to the BLOB value that this Blob |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
252 * object represents, starting at position pos, and returns the |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
253 * number of bytes written. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
254 * |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
255 * @param pos the position in the BLOB object at which to start writing |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
256 * @param bytes the array of bytes to be written to the BLOB value |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
257 * that this Blob object represents |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
258 * @return the number of bytes written |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
259 * @throws SQLException if there is an error accessing the |
209
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
260 * BLOB value or if pos is less than 1 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
261 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
262 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
263 public int setBytes(final long pos, final byte[] bytes) throws SQLException { |
316
d479475888e3
Replace StringBuilder methods sb.delete(0, sb.length()) with faster sb.setLength(0).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
264 // buf and input arguments will be checked in method setBytes(long, byte{}, int, int) |
d479475888e3
Replace StringBuilder methods sb.delete(0, sb.length()) with faster sb.setLength(0).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
265 final int len = (bytes != null) ? bytes.length : 0; |
d479475888e3
Replace StringBuilder methods sb.delete(0, sb.length()) with faster sb.setLength(0).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
266 return setBytes(pos, bytes, 1, len); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
267 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
268 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
269 /** |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
270 * Writes all or part of the given byte array to the BLOB value that |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
271 * this Blob object represents and returns the number of bytes written. |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
272 * Writing starts at position pos in the BLOB value; len bytes from |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
273 * the given byte array are written. |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
274 * |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
275 * @param pos the position in the BLOB object at which to start writing |
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
276 * @param bytes the array of bytes to be written to this BLOB object |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
277 * @param offset the offset into the array bytes at which to start |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
278 * reading the bytes to be set |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
279 * @param len the number of bytes to be written to the BLOB value |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
280 * from the array of bytes bytes |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
281 * @return the number of bytes written |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
282 * @throws SQLException if there is an error accessing the |
209
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
283 * BLOB value or if pos is less than 1 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
284 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
285 @Override |
316
d479475888e3
Replace StringBuilder methods sb.delete(0, sb.length()) with faster sb.setLength(0).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
286 public int setBytes(final long pos, final byte[] bytes, int offset, final int len) |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
287 throws SQLException |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
288 { |
150
c5309def7d4b
Improve MonetBlob implementation.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
90
diff
changeset
|
289 checkBufIsNotNull(); |
209
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
290 if (bytes == null) { |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
291 throw new SQLException("Missing bytes[] object", "M1M05"); |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
292 } |
316
d479475888e3
Replace StringBuilder methods sb.delete(0, sb.length()) with faster sb.setLength(0).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
293 if (pos < 1 || pos > buf.length) { |
209
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
294 throw new SQLException("Invalid pos value: " + pos, "M1M05"); |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
295 } |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
296 if (len < 0 || pos + len > buf.length) { |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
297 throw new SQLException("Invalid len value: " + len, "M1M05"); |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
298 } |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
299 if (offset < 0 || offset > bytes.length) { |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
300 throw new SQLException("Invalid offset value: " + offset, "M1M05"); |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
301 } |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
302 |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
303 try { |
316
d479475888e3
Replace StringBuilder methods sb.delete(0, sb.length()) with faster sb.setLength(0).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
304 offset--; |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
305 /* transactions? what are you talking about? */ |
819
726a1d7b168c
correct indentation
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
814
diff
changeset
|
306 if (len - (int) pos >= 0) |
726a1d7b168c
correct indentation
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
814
diff
changeset
|
307 System.arraycopy(bytes, offset + (int) pos, buf, (int) pos, len - (int) pos); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
308 } catch (IndexOutOfBoundsException e) { |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
309 throw new SQLException(e.getMessage(), "M0M10"); |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
310 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
311 return len; |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
312 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
313 |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
314 /** |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
315 * Truncates the BLOB value that this Blob object represents to be |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
316 * len bytes in length. |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
317 * |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
318 * @param len the length, in bytes, to which the BLOB value |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
319 * should be truncated |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
320 * @throws SQLException if there is an error accessing the BLOB value |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
321 */ |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
322 @Override |
295
003ae6d881db
Add "final" keyword to method arguments and local variables where possible.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
266
diff
changeset
|
323 public void truncate(final long len) throws SQLException { |
150
c5309def7d4b
Improve MonetBlob implementation.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
90
diff
changeset
|
324 checkBufIsNotNull(); |
209
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
325 if (len < 0 || len > buf.length) { |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
326 throw new SQLException("Invalid len value: " + len, "M1M05"); |
94131372ad0b
Improved implementation of MonetClob and MonetBlob classes by adding checks on validity of input parameters of methods of those classes.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
200
diff
changeset
|
327 } |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
328 if (buf.length > len) { |
316
d479475888e3
Replace StringBuilder methods sb.delete(0, sb.length()) with faster sb.setLength(0).
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
295
diff
changeset
|
329 buf = java.util.Arrays.copyOf(buf, (int)len); |
0
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
330 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
331 } |
a5a898f6886c
Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff
changeset
|
332 } |