@@ -77,6 +77,19 @@ public interface BlobContainer {
77
77
*/
78
78
InputStream readBlob (String blobName ) throws IOException ;
79
79
80
+ /**
81
+ * Creates a new {@link BlobDownloadResponse} for the given blob name.
82
+ *
83
+ * @param blobName
84
+ * The name of the blob to get an {@link InputStream} for.
85
+ * @return The {@code InputStream} to read the blob.
86
+ * @throws NoSuchFileException if the blob does not exist
87
+ * @throws IOException if the blob can not be read.
88
+ */
89
+ default BlobDownloadResponse readBlobWithMetadata (String blobName ) throws IOException {
90
+ return null ;
91
+ };
92
+
80
93
/**
81
94
* Creates a new {@link InputStream} that can be used to read the given blob starting from
82
95
* a specific {@code position} in the blob. The {@code length} is an indication of the
@@ -128,6 +141,33 @@ default long readBlobPreferredLength() {
128
141
*/
129
142
void writeBlob (String blobName , InputStream inputStream , long blobSize , boolean failIfAlreadyExists ) throws IOException ;
130
143
144
+ /**
145
+ * Reads blob content from the input stream and writes it to the container in a new blob with the given name, and metadata.
146
+ * This method assumes the container does not already contain a blob of the same blobName. If a blob by the
147
+ * same name already exists, the operation will fail and an {@link IOException} will be thrown.
148
+ *
149
+ * @param blobName
150
+ * The name of the blob to write the contents of the input stream to.
151
+ * @param inputStream
152
+ * The input stream from which to retrieve the bytes to write to the blob.
153
+ * @param metadata
154
+ * The metadata to be associate with the blob upload.
155
+ * @param blobSize
156
+ * The size of the blob to be written, in bytes. It is implementation dependent whether
157
+ * this value is used in writing the blob to the repository.
158
+ * @param failIfAlreadyExists
159
+ * whether to throw a FileAlreadyExistsException if the given blob already exists
160
+ * @throws FileAlreadyExistsException if failIfAlreadyExists is true and a blob by the same name already exists
161
+ * @throws IOException if the input stream could not be read, or the target blob could not be written to.
162
+ */
163
+ default void writeBlobWithMetadata (
164
+ String blobName ,
165
+ InputStream inputStream ,
166
+ Map <String , String > metadata ,
167
+ long blobSize ,
168
+ boolean failIfAlreadyExists
169
+ ) throws IOException {};
170
+
131
171
/**
132
172
* Reads blob content from the input stream and writes it to the container in a new blob with the given name,
133
173
* using an atomic write operation if the implementation supports it.
@@ -149,6 +189,35 @@ default long readBlobPreferredLength() {
149
189
*/
150
190
void writeBlobAtomic (String blobName , InputStream inputStream , long blobSize , boolean failIfAlreadyExists ) throws IOException ;
151
191
192
+ /**
193
+ * Reads blob content from the input stream and writes it to the container in a new blob with the given name,and metadata
194
+ * using an atomic write operation if the implementation supports it.
195
+ * <p>
196
+ * This method assumes the container does not already contain a blob of the same blobName. If a blob by the
197
+ * same name already exists, the operation will fail and an {@link IOException} will be thrown.
198
+ *
199
+ * @param blobName
200
+ * The name of the blob to write the contents of the input stream to.
201
+ * @param inputStream
202
+ * The input stream from which to retrieve the bytes to write to the blob.
203
+ * @param metadata
204
+ * The metadata to be associate with the blob upload.
205
+ * @param blobSize
206
+ * The size of the blob to be written, in bytes. It is implementation dependent whether
207
+ * this value is used in writing the blob to the repository.
208
+ * @param failIfAlreadyExists
209
+ * whether to throw a FileAlreadyExistsException if the given blob already exists
210
+ * @throws FileAlreadyExistsException if failIfAlreadyExists is true and a blob by the same name already exists
211
+ * @throws IOException if the input stream could not be read, or the target blob could not be written to.
212
+ */
213
+ default void writeBlobAtomicWithMetadata (
214
+ String blobName ,
215
+ InputStream inputStream ,
216
+ Map <String , String > metadata ,
217
+ long blobSize ,
218
+ boolean failIfAlreadyExists
219
+ ) throws IOException {};
220
+
152
221
/**
153
222
* Deletes this container and all its contents from the repository.
154
223
*
0 commit comments