1 |
/* Blob.java -- Access a SQL Binary Large OBject. |
/* Blob.java -- Access a SQL Binary Large OBject. |
2 |
Copyright (C) 1999, 2000 Free Software Foundation, Inc. |
Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
35 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
|
|
|
38 |
package java.sql; |
package java.sql; |
39 |
|
|
40 |
import java.io.InputStream; |
import java.io.InputStream; |
41 |
|
import java.io.OutputStream; |
42 |
|
|
43 |
/** |
/** |
44 |
* This interface specified methods for accessing a SQL BLOB (Binary |
* This interface specified methods for accessing a SQL BLOB (Binary |
45 |
* Large OBject) type. |
* Large OBject) type. |
46 |
* |
* |
47 |
* @author Aaron M. Renn (arenn@urbanophile.com) |
* @author Aaron M. Renn (arenn@urbanophile.com) |
48 |
*/ |
* @since 1.2 |
49 |
public interface Blob |
*/ |
50 |
|
public interface Blob |
51 |
{ |
{ |
52 |
|
/** |
53 |
/*************************************************************************/ |
* This method returns the number of bytes in the BLOB. |
54 |
|
* |
55 |
/** |
* @return The number of bytes in the BLOB. |
56 |
* This method returns the number of bytes in the BLOB. |
* @exception SQLException If an error occurs. |
57 |
* |
*/ |
58 |
* @return The number of bytes in the BLOB. |
public long length() throws SQLException; |
59 |
* |
|
60 |
* @exception SQLException If an error occurs. |
/** |
61 |
*/ |
* This method returns up to the requested bytes of this BLOB as a |
62 |
public abstract long |
* <code>byte</code> array. |
63 |
length() throws SQLException; |
* |
64 |
|
* @param pos The index into the BLOB to start returning bytes from. |
65 |
/*************************************************************************/ |
* @param length The requested number of bytes to return. |
66 |
|
* @return The requested bytes from the BLOB. |
67 |
/** |
* @exception SQLException If an error occurs. |
68 |
* This method returns up to the requested bytes of this BLOB as a |
*/ |
69 |
* <code>byte</code> array. |
public byte[] getBytes(long pos, int length) throws SQLException; |
70 |
* |
|
71 |
* @param offset The index into the BLOB to start returning bytes from. |
/** |
72 |
* @param length The requested number of bytes to return. |
* This method returns a stream that will read the bytes of the BLOB. |
73 |
* |
* |
74 |
* @return The requested bytes from the BLOB. |
* @return A stream that will read the bytes of the BLOB. |
75 |
* |
* @exception SQLException If an error occurs. |
76 |
* @exception SQLException If an error occurs. |
*/ |
77 |
*/ |
public InputStream getBinaryStream() throws SQLException; |
78 |
public abstract byte[] |
|
79 |
getBytes(long offset, int length) throws SQLException; |
/** |
80 |
|
* This method returns the index into the BLOB at which the first instance |
81 |
/*************************************************************************/ |
* of the specified bytes occur. The searching starts at the specified |
82 |
|
* index into the BLOB. |
83 |
/** |
* |
84 |
* This method returns a stream that will read the bytes of the BLOB. |
* @param pattern The byte pattern to search for. |
85 |
* |
* @param offset The index into the BLOB to starting searching for the pattern. |
86 |
* @return A stream that will read the bytes of the BLOB. |
* @return The offset at which the pattern is first found, or -1 if the |
87 |
* |
* pattern is not found. |
88 |
* @exception SQLException If an error occurs. |
* @exception SQLException If an error occurs. |
89 |
*/ |
*/ |
90 |
public abstract InputStream |
public long position(byte[] pattern, long start) throws SQLException; |
91 |
getBinaryStream() throws SQLException; |
|
92 |
|
/** |
93 |
/*************************************************************************/ |
* This method returns the index into the BLOB at which the first instance |
94 |
|
* of the specified pattern occurs. The searching starts at the specified |
95 |
/** |
* index into this BLOB. The bytes in the specified <code>Blob</code> are |
96 |
* This method returns the index into the BLOB at which the first instance |
* used as the search pattern. |
97 |
* of the specified bytes occur. The searching starts at the specified |
* |
98 |
* index into the BLOB. |
* @param pattern The <code>Blob</code> containing the byte pattern to |
99 |
* |
* search for. |
100 |
* @param pattern The byte pattern to search for. |
* @param offset The index into the BLOB to starting searching for the pattern. |
101 |
* @param offset The index into the BLOB to starting searching for the pattern. |
* @return The offset at which the pattern is first found, or -1 if the |
102 |
* |
* pattern is not found. |
103 |
* @return The offset at which the pattern is first found, or -1 if the |
* @exception SQLException If an error occurs. |
104 |
* pattern is not found. |
*/ |
105 |
* |
public long position(Blob pattern, long start) throws SQLException; |
106 |
* @exception SQLException If an error occurs. |
|
107 |
*/ |
/** |
108 |
public abstract long |
* @exception SQLException If an error occurs. |
109 |
position(byte[] pattern, long offset) throws SQLException; |
* @since 1.4 |
110 |
|
*/ |
111 |
/*************************************************************************/ |
public int setBytes(long pos, byte[] bytes) throws SQLException; |
112 |
|
|
113 |
/** |
/** |
114 |
* This method returns the index into the BLOB at which the first instance |
* @exception SQLException If an error occurs. |
115 |
* of the specified pattern occurs. The searching starts at the specified |
* @since 1.4 |
116 |
* index into this BLOB. The bytes in the specified <code>Blob</code> are |
*/ |
117 |
* used as the search pattern. |
public int setBytes(long pos, byte[] bytes, int offset, int len) |
118 |
* |
throws SQLException; |
119 |
* @param pattern The <code>Blob</code> containing the byte pattern to |
|
120 |
* search for. |
/** |
121 |
* @param offset The index into the BLOB to starting searching for the pattern. |
* @exception SQLException If an error occurs. |
122 |
* |
* @since 1.4 |
123 |
* @return The offset at which the pattern is first found, or -1 if the |
*/ |
124 |
* pattern is not found. |
public OutputStream setBinaryStream(long pos) throws SQLException; |
125 |
* |
|
126 |
* @exception SQLException If an error occurs. |
/** |
127 |
*/ |
* @exception SQLException If an error occurs. |
128 |
public abstract long |
* @since 1.4 |
129 |
position(Blob pattern, long offset) throws SQLException; |
*/ |
130 |
|
public void truncate(long len) throws SQLException; |
131 |
} // interface Blob |
} |
|
|
|