Package io.deephaven.util.channel
Class SeekableChannelsProviderDelegate
java.lang.Object
io.deephaven.util.channel.SeekableChannelsProviderDelegate
- All Implemented Interfaces:
SeekableChannelsProvider,SafeCloseable,AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.util.channel.SeekableChannelsProvider
SeekableChannelsProvider.WriteContext -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()booleanReturns true if the given URI exists in the underlying storage.getInputStream(SeekableByteChannel channel, int sizeHint) Creates anInputStreamfrom the current position ofchannelfrom which the caller expects to readsizeHintnumber of bytes.getOutputStream(@NotNull SeekableChannelsProvider.WriteContext channelContext, @NotNull URI uri, int bufferSizeHint) Creates aCompletableOutputStreamto write to the given URI.getReadChannel(@NotNull SeekableChannelContext channelContext, @NotNull String uriStr) getReadChannel(@NotNull SeekableChannelContext channelContext, @NotNull URI uri) booleanisCompatibleWith(@NotNull SeekableChannelContext channelContext) Check if the given context is compatible with this provider for reading.Returns a stream of URIs, the elements of which are the entries in the directory.Create a newSeekableChannelContextobject for creating read channels via this provider.Create a new "single-use"SeekableChannelContextobject for creating read channels via this provider.Create a new context object for creating output streams via this provider.Returns a stream of URIs, the elements of which are all the files in the file tree rooted at the given starting directory.
-
Field Details
-
delegate
-
-
Constructor Details
-
SeekableChannelsProviderDelegate
-
-
Method Details
-
makeReadContext
Description copied from interface:SeekableChannelsProviderCreate a newSeekableChannelContextobject for creating read channels via this provider.- Specified by:
makeReadContextin interfaceSeekableChannelsProvider
-
makeWriteContext
Description copied from interface:SeekableChannelsProviderCreate a new context object for creating output streams via this provider.- Specified by:
makeWriteContextin interfaceSeekableChannelsProvider
-
isCompatibleWith
Description copied from interface:SeekableChannelsProviderCheck if the given context is compatible with this provider for reading. Useful to test if we can use providedchannelContextobject for creating read channels with this provider.- Specified by:
isCompatibleWithin interfaceSeekableChannelsProvider
-
exists
Description copied from interface:SeekableChannelsProviderReturns true if the given URI exists in the underlying storage.- Specified by:
existsin interfaceSeekableChannelsProvider- Parameters:
uri- the URI to check- Returns:
- true if the URI exists
-
getReadChannel
public SeekableByteChannel getReadChannel(@NotNull @NotNull SeekableChannelContext channelContext, @NotNull @NotNull URI uri) throws IOException - Specified by:
getReadChannelin interfaceSeekableChannelsProvider- Throws:
IOException
-
getInputStream
Description copied from interface:SeekableChannelsProviderCreates anInputStreamfrom the current position ofchannelfrom which the caller expects to readsizeHintnumber of bytes. Closing the resulting input stream does not close thechannel. TheInputStreamwill be buffered; either explicitly in the case where the implementation uses an unbufferedSeekableChannelsProvider.getReadChannel(SeekableChannelContext, URI), or implicitly when the implementation uses a bufferedSeekableChannelsProvider.getReadChannel(SeekableChannelContext, URI).channelmust have been created bythisprovider. The caller can't assume the position ofchannelafter consuming theInputStream. For use-cases that require the channel's position to be incremented the exact amount theInputStreamhas been consumed, useSeekableChannelsProvider.channelPositionInputStream(SeekableChannelsProvider, SeekableByteChannel, int).- Specified by:
getInputStreamin interfaceSeekableChannelsProvider- Parameters:
channel- the channelsizeHint- the number of bytes the caller expects to read from the input stream- Returns:
- the input stream
- Throws:
IOException- if an IO exception occurs
-
getOutputStream
public CompletableOutputStream getOutputStream(@NotNull @NotNull SeekableChannelsProvider.WriteContext channelContext, @NotNull @NotNull URI uri, int bufferSizeHint) throws IOException Description copied from interface:SeekableChannelsProviderCreates aCompletableOutputStreamto write to the given URI.- Specified by:
getOutputStreamin interfaceSeekableChannelsProvider- Parameters:
channelContext- the channel context to use for creating the output streamuri- the URI to write tobufferSizeHint- the number of bytes the caller expects to buffer before flushing- Returns:
- the output stream
- Throws:
IOException- if an IO exception occurs- See Also:
-
list
Description copied from interface:SeekableChannelsProviderReturns a stream of URIs, the elements of which are the entries in the directory. The listing is non-recursive. The URIs supplied by the stream will not have any unnecessary slashes or path separators. Also, the URIs will be file URIs (not ending with "/") irrespective of whether the URI corresponds to a file or a directory. The caller should manage file vs. directory handling in the processor. The caller is also responsible for closing the stream, preferably using a try-with-resources block.- Specified by:
listin interfaceSeekableChannelsProvider- Parameters:
directory- the URI of the directory to list- Returns:
- The
StreamofURIs - Throws:
IOException
-
walk
Description copied from interface:SeekableChannelsProviderReturns a stream of URIs, the elements of which are all the files in the file tree rooted at the given starting directory. The URIs supplied by the stream will not have any unnecessary slashes or path separators. Also, the URIs will be file URIs (not ending with "/") irrespective of whether the URI corresponds to a file or a directory. The caller should manage file vs. directory handling in the processor. The caller is also responsible for closing the stream, preferably using a try-with-resources block.- Specified by:
walkin interfaceSeekableChannelsProvider- Parameters:
directory- the URI of the directory to walk- Returns:
- The
StreamofURIs - Throws:
IOException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSafeCloseable
-
makeSingleUseReadContext
Description copied from interface:SeekableChannelsProviderCreate a new "single-use"SeekableChannelContextobject for creating read channels via this provider. This is meant for contexts that have a short lifecycle and expect to read a small amount from a read channel.- Specified by:
makeSingleUseReadContextin interfaceSeekableChannelsProvider
-
getReadChannel
public SeekableByteChannel getReadChannel(@NotNull @NotNull SeekableChannelContext channelContext, @NotNull @NotNull String uriStr) throws IOException - Specified by:
getReadChannelin interfaceSeekableChannelsProvider- Throws:
IOException
-