cstamas commented on code in PR #1752:
URL: https://github.com/apache/maven-resolver/pull/1752#discussion_r2694918161
##########
maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/transport/PutTask.java:
##########
@@ -54,14 +58,33 @@ public PutTask(URI location) {
*
* @return The input stream for the data, never {@code null}. The stream
is unbuffered.
* @throws IOException If the stream could not be opened.
+ * @deprecated Use {@link #newByteChannel()} instead.
*/
+ @Deprecated
public InputStream newInputStream() throws IOException {
if (dataPath != null) {
return Files.newInputStream(dataPath);
}
return new ByteArrayInputStream(dataBytes);
}
+ /**
+ * Opens a seekable byte channel for the data to be uploaded. The length
of the channel can be queried via
+ * {@link #getDataLength()}. It's the responsibility of the caller to
close the provided channel.
+ * Write operations on the returned channel will throw {@link
java.nio.channels.NonWritableChannelException}.
+ *
+ * @return The seekable byte channel for the data, never {@code null}.
+ * @throws IOException If the channel could not be opened.
+ * @since 2.1.0
+ * @see #getInputStream()
+ */
+ public SeekableByteChannel newByteChannel() throws IOException {
Review Comment:
And why not just expose the `byte[]`? And leave to caller to do with it what
it wants? Just like `Path` is exposed, and payload is one of those two...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]