@@ -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,27 @@ 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 (String blobName , InputStream inputStream , Map <String , String > metadata , long blobSize , boolean failIfAlreadyExists ) throws IOException {};
164
+
131
165
/**
132
166
* Reads blob content from the input stream and writes it to the container in a new blob with the given name,
133
167
* using an atomic write operation if the implementation supports it.
@@ -149,6 +183,29 @@ default long readBlobPreferredLength() {
149
183
*/
150
184
void writeBlobAtomic (String blobName , InputStream inputStream , long blobSize , boolean failIfAlreadyExists ) throws IOException ;
151
185
186
+ /**
187
+ * Reads blob content from the input stream and writes it to the container in a new blob with the given name,and metadata
188
+ * using an atomic write operation if the implementation supports it.
189
+ * <p>
190
+ * This method assumes the container does not already contain a blob of the same blobName. If a blob by the
191
+ * same name already exists, the operation will fail and an {@link IOException} will be thrown.
192
+ *
193
+ * @param blobName
194
+ * The name of the blob to write the contents of the input stream to.
195
+ * @param inputStream
196
+ * The input stream from which to retrieve the bytes to write to the blob.
197
+ * @param metadata
198
+ * The metadata to be associate with the blob upload.
199
+ * @param blobSize
200
+ * The size of the blob to be written, in bytes. It is implementation dependent whether
201
+ * this value is used in writing the blob to the repository.
202
+ * @param failIfAlreadyExists
203
+ * whether to throw a FileAlreadyExistsException if the given blob already exists
204
+ * @throws FileAlreadyExistsException if failIfAlreadyExists is true and a blob by the same name already exists
205
+ * @throws IOException if the input stream could not be read, or the target blob could not be written to.
206
+ */
207
+ default void writeBlobAtomicWithMetadata (String blobName , InputStream inputStream , Map <String , String > metadata , long blobSize , boolean failIfAlreadyExists ) throws IOException {};
208
+
152
209
/**
153
210
* Deletes this container and all its contents from the repository.
154
211
*
0 commit comments