Skip to content

Commit

Permalink
Javadoc cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
markjschreiber committed Jun 30, 2023
1 parent c3e3ca8 commit cf751b0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/main/java/software/amazon/nio/spi/s3/S3FileSystemProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> o
/**
* Construct a byte channel for the path with the specified client. A more composable and testable (by using a Mock Client)
* version of the public method
* @param client a client that will make data requests for the channel
* @param path the path to read from. Must not be null.
* @param options a set of zero or more open options. May be null.
* @param attrs optional file attributes to set.
* @return An {@link S3SeekableByteChannel}
* @throws IOException if the channel creation fails
*/
protected SeekableByteChannel newByteChannel(S3AsyncClient client, Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException {
if (Objects.isNull(options)) {
Expand Down Expand Up @@ -231,6 +237,7 @@ protected SeekableByteChannel newByteChannel(S3AsyncClient client, Path path, Se
* @param dir the path to the directory
* @param filter the directory stream filter
* @return a new and open {@code DirectoryStream} object
* @throws IOException if the stream cannot be created or has a streaming problem.
*/
@Override
public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) throws IOException {
Expand All @@ -247,6 +254,12 @@ public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter
/**
* Get a new directory stream that will use the specified client. A composable and testable version of the public
* version of {@code newDirectoryStream}
* @param s3Client the client to use for calls to S3
* @param dir the path to the directory
* @param filter the directory stream filter
* @return a new and open {@code DirectoryStream} object
* @throws ExecutionException if the async operation cannot be executed.
* @throws InterruptedException if the async operation is interrupted.
*/
protected DirectoryStream<Path> newDirectoryStream(S3AsyncClient s3Client, Path dir, DirectoryStream.Filter<? super Path> filter) throws ExecutionException, InterruptedException {
S3Path s3Path = (S3Path) dir;
Expand Down Expand Up @@ -667,6 +680,12 @@ public void checkAccess(Path path, AccessMode... modes) throws IOException {

/**
* Composable and testable version of {@code checkAccess} that uses the provided client to check access
* @param s3Client the client to use for S3 operations
* @param path the path to the file to check
* @param modes The access modes to check; may have zero elements
* @throws IOException if an IO error occurs when trying to check access
* @throws ExecutionException if the async operation execution fails
* @throws InterruptedException if the async operation is interrupted
*/
protected void checkAccess(S3AsyncClient s3Client, Path path, AccessMode... modes) throws IOException, ExecutionException, InterruptedException {
assert path instanceof S3Path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public class S3ReadAheadByteChannel implements ReadableByteChannel {
* @param maxNumberFragments the maximum number of read ahead fragments to hold. Must be {@code >= 2}.
* @param client the client used to read from the {@code path}
* @param delegator the {@code S3SeekableByteChannel} that delegates reading to this object.
* @param timeout the amount of time after which the operation will timeout
* @param timeUnit the unit of time for the timeout
* @throws IOException if a problem occurs initializing the cached fragments
*/
public S3ReadAheadByteChannel(S3Path path, int maxFragmentSize, int maxNumberFragments, S3AsyncClient client, S3SeekableByteChannel delegator, Long timeout, TimeUnit timeUnit) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ protected S3SeekableByteChannel(S3Path s3Path, S3AsyncClient s3Client) throws IO
/**
* @deprecated startAt is only a valid parameter for the read mode and is
* therefore discouraged to be used during creation of the channel
* @param s3Client the client to use for S3 operations
* @param s3Path the path to open a byte channel for
* @param startAt the byte offset to start at. Implicitly for a read channel.
* @throws IOException if the channel cannot be created.
*/
@Deprecated
protected S3SeekableByteChannel(S3Path s3Path, S3AsyncClient s3Client, long startAt) throws IOException {
Expand All @@ -52,6 +56,9 @@ protected S3SeekableByteChannel(S3Path s3Path, S3AsyncClient s3Client, long star
/**
* @deprecated startAt is only a valid parameter for the read mode and is
* therefore discouraged to be used during creation of the channel
* @param s3Path the path to open a byte channel for
* @param startAt the byte offset to start at. Implicitly for a read channel.
* @throws IOException if the channel cannot be created.
*/
@Deprecated
protected S3SeekableByteChannel(S3Path s3Path, long startAt) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void newByteChannel() throws IOException {
}

@Test
public void newDirectoryStream() throws ExecutionException, InterruptedException {
public void newDirectoryStream() throws ExecutionException, InterruptedException, IOException {

S3Object object1 = S3Object.builder().key("key1").build();
S3Object object2 = S3Object.builder().key("foo/key2").build();
Expand Down

0 comments on commit cf751b0

Please sign in to comment.