You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "kwin (via GitHub)" <gi...@apache.org> on 2026/01/15 13:53:22 UTC
[PR] Expose SeekableByteChannel from PutTask [maven-resolver]
kwin opened a new pull request, #1752:
URL: https://github.com/apache/maven-resolver/pull/1752
This closes #1751
Following this checklist to help us incorporate your
contribution quickly and easily:
- [ ] Your pull request should address just one issue, without pulling in other changes.
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [ ] Each commit in the pull request should have a meaningful subject line and body.
Note that commits might be squashed by a maintainer on merge.
- [ ] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
This may not always be possible but is a best-practice.
- [ ] Run `mvn verify` to make sure basic checks pass.
A more thorough check will be performed on your pull request automatically.
- [ ] You have run the integration tests successfully (`mvn -Prun-its verify`).
If your pull request is about ~20 lines of code you don't need to sign an
[Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.
- [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
- [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SeekableByteChannel from PutTask [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SeekableByteChannel from PutTask [maven-resolver]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #1752:
URL: https://github.com/apache/maven-resolver/pull/1752#discussion_r2699684146
##########
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:
ok, since my use case for having that is gone, I am fine with not merging this right now.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SeekableByteChannel from PutTask [maven-resolver]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #1752:
URL: https://github.com/apache/maven-resolver/pull/1752#discussion_r2699669219
##########
maven-resolver-spi/pom.xml:
##########
@@ -47,6 +47,11 @@
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.21.0</version>
Review Comment:
Right, transitive dep of commons-codec: https://commons.apache.org/proper/commons-codec/dependencies.html
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SeekableByteChannel from PutTask [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1752:
URL: https://github.com/apache/maven-resolver/pull/1752#discussion_r2699680891
##########
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:
I just find it awkward to pull in whole library for this one single class....
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SeekableByteChannel from PutTask [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1752:
URL: https://github.com/apache/maven-resolver/pull/1752#discussion_r2699079840
##########
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:
with byte array exposed this method is not needed, is it?
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SeekableByteChannel from PutTask [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1752:
URL: https://github.com/apache/maven-resolver/pull/1752#discussion_r2694915324
##########
maven-resolver-spi/pom.xml:
##########
@@ -47,6 +47,11 @@
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.21.0</version>
Review Comment:
Pull up, as we already have commons-io as dependency somewhere, so let them have aligned. Same for commons-codec, so even if this PR goes in as-is (which is fine) we need another pass to pull these up.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SeekableByteChannel from PutTask [maven-resolver]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin closed pull request #1752: Expose SeekableByteChannel from PutTask
URL: https://github.com/apache/maven-resolver/pull/1752
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SeekableByteChannel from PutTask [maven-resolver]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #1752:
URL: https://github.com/apache/maven-resolver/pull/1752#discussion_r2694923718
##########
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:
In order to not make the caller distinguish between the two types.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SeekableByteChannel from PutTask [maven-resolver]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #1752:
URL: https://github.com/apache/maven-resolver/pull/1752#discussion_r2694484884
##########
maven-resolver-spi/pom.xml:
##########
@@ -47,6 +47,11 @@
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
+ <dependency>
Review Comment:
@cstamas I don't like this additional dependency but unfortunately there is no impl in Java for a SeekableByteChannel on top of a byte array...
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SeekableByteChannel from PutTask [maven-resolver]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #1752:
URL: https://github.com/apache/maven-resolver/pull/1752#discussion_r2697197225
##########
maven-resolver-spi/pom.xml:
##########
@@ -47,6 +47,11 @@
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.21.0</version>
Review Comment:
I couldn't find any other usage of commons-io yet.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SeekableByteChannel from PutTask [maven-resolver]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #1752:
URL: https://github.com/apache/maven-resolver/pull/1752#discussion_r2694995586
##########
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:
I am fine though with exposing the byte array through a dedicated getter for some edge cases as well
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SeekableByteChannel from PutTask [maven-resolver]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #1752:
URL: https://github.com/apache/maven-resolver/pull/1752#discussion_r2699077450
##########
maven-resolver-spi/pom.xml:
##########
@@ -47,6 +47,11 @@
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.21.0</version>
Review Comment:
In my IDE it shows
<img width="607" height="213" alt="Image" src="https://github.com/user-attachments/assets/3994c70b-8a58-4e85-b8cf-fcda7199549a" />
So probably not direct deps, but we may want to pull them up (and also figure out what commons-logging does here at all)
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Expose SeekableByteChannel from PutTask [maven-resolver]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on code in PR #1752:
URL: https://github.com/apache/maven-resolver/pull/1752#discussion_r2699672379
##########
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:
I still think this is beneficial as only newInputStream() and newByteChannel() can be used no matter how the data has been provided.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org