Class PutTaskRequestContent

java.lang.Object
org.eclipse.jetty.io.content.ByteBufferContentSource
org.eclipse.jetty.client.ByteBufferRequestContent
org.eclipse.aether.transport.jetty.PutTaskRequestContent
All Implemented Interfaces:
org.eclipse.jetty.client.Request.Content, org.eclipse.jetty.io.Content.Source

public class PutTaskRequestContent extends org.eclipse.jetty.client.ByteBufferRequestContent implements org.eclipse.jetty.client.Request.Content
Heavily inspired by Jetty's org.eclipse.jetty.io.internal.ByteChannelContentSource but adjusted to deal with ReadableByteChannels and to support rewind (to be able to retry the requests). Also, Jetty's ByteChannelContentSource is an internal package so should not be used directly.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Content.Source

    org.eclipse.jetty.io.Content.Source.Factory
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    PutTaskRequestContent(org.eclipse.jetty.io.ByteBufferPool.Sized byteBufferPool, Supplier<ReadableByteChannel> newByteChannelSupplier)
    Create a ByteChannelContentSource which reads from a ByteChannel.
    protected
    PutTaskRequestContent(org.eclipse.jetty.io.ByteBufferPool.Sized byteBufferPool, Supplier<ReadableByteChannel> newByteChannelSupplier, long offset, long length)
    Create a ByteChannelContentSource which reads from a ByteChannel.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    demand(Runnable demandCallback)
     
    void
    fail(Throwable failure)
     
    static org.eclipse.jetty.client.Request.Content
    from(PutTask putTask)
     
    long
     
    protected void
    lockedSetTerminal(org.eclipse.jetty.io.Content.Chunk terminal)
     
     
    org.eclipse.jetty.io.Content.Chunk
     
    boolean
     

    Methods inherited from class org.eclipse.jetty.client.ByteBufferRequestContent

    getContentType

    Methods inherited from class org.eclipse.jetty.io.content.ByteBufferContentSource

    getByteBuffers

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.eclipse.jetty.io.Content.Source

    fail

    Methods inherited from interface org.eclipse.jetty.client.Request.Content

    getContentType
  • Constructor Details

    • PutTaskRequestContent

      protected PutTaskRequestContent(org.eclipse.jetty.io.ByteBufferPool.Sized byteBufferPool, Supplier<ReadableByteChannel> newByteChannelSupplier)
      Create a ByteChannelContentSource which reads from a ByteChannel.
      Parameters:
      byteBufferPool - The ByteBufferPool.Sized to use for any internal buffers.
      newByteChannelSupplier - The ByteChannel supplier.
    • PutTaskRequestContent

      protected PutTaskRequestContent(org.eclipse.jetty.io.ByteBufferPool.Sized byteBufferPool, Supplier<ReadableByteChannel> newByteChannelSupplier, long offset, long length)
      Create a ByteChannelContentSource which reads from a ByteChannel. If the ByteChannel is an instance of SeekableByteChannel the implementation will use SeekableByteChannel.position(long) to navigate to the starting offset.
      Parameters:
      byteBufferPool - The ByteBufferPool.Sized to use for any internal buffers.
      newByteChannelSupplier - The ByteChannel supplier.
      offset - the offset byte of the content to start from. Must be greater than or equal to 0 and less than the content length (if known).
      length - the length of the content to make available, -1 for the full length. If the size of the content is known, the length may be truncated to the content size minus the offset.
      Throws:
      IndexOutOfBoundsException - if the offset or length are out of range.
      See Also:
      • TypeUtil.checkOffsetLengthSize(long, long, long)
  • Method Details

    • from

      public static org.eclipse.jetty.client.Request.Content from(PutTask putTask)
    • open

      protected ReadableByteChannel open() throws IOException
      Throws:
      IOException
    • demand

      public void demand(Runnable demandCallback)
      Specified by:
      demand in interface org.eclipse.jetty.io.Content.Source
      Overrides:
      demand in class org.eclipse.jetty.io.content.ByteBufferContentSource
    • lockedSetTerminal

      protected void lockedSetTerminal(org.eclipse.jetty.io.Content.Chunk terminal)
    • read

      public org.eclipse.jetty.io.Content.Chunk read()
      Specified by:
      read in interface org.eclipse.jetty.io.Content.Source
      Overrides:
      read in class org.eclipse.jetty.io.content.ByteBufferContentSource
    • fail

      public void fail(Throwable failure)
      Specified by:
      fail in interface org.eclipse.jetty.io.Content.Source
      Overrides:
      fail in class org.eclipse.jetty.io.content.ByteBufferContentSource
    • getLength

      public long getLength()
      Specified by:
      getLength in interface org.eclipse.jetty.io.Content.Source
      Overrides:
      getLength in class org.eclipse.jetty.io.content.ByteBufferContentSource
    • rewind

      public boolean rewind()
      Specified by:
      rewind in interface org.eclipse.jetty.io.Content.Source
      Overrides:
      rewind in class org.eclipse.jetty.io.content.ByteBufferContentSource