Class DataBufferAdapterFactory


  • public class DataBufferAdapterFactory
    extends Object
    Factory of data buffer adapters.

    Data buffer adapters are used to apply a DataLayout to a buffer. Conceptually, they act as a proxy that intercept each I/O call and perform the required type conversions after/before delegating the task to the underlying buffer.

    • Constructor Detail

      • DataBufferAdapterFactory

        public DataBufferAdapterFactory()
    • Method Detail

      • create

        public static <S extends DataBuffer<?>> ByteDataBuffer create​(S buffer,
                                                                      ByteDataLayout<S> layout)
        Creates an adapter that applies a byte data layout to the given buffer.
        Type Parameters:
        S - the type of the buffer
        Parameters:
        buffer - the delegate buffer
        layout - layout to apply
        Returns:
        buffer adapter
      • create

        public static <S extends DataBuffer<?>> BooleanDataBuffer create​(S buffer,
                                                                         BooleanDataLayout<S> layout)
        Creates an adapter that applies a boolean data layout to the given buffer.
        Type Parameters:
        S - the type of the buffer
        Parameters:
        buffer - the delegate buffer
        layout - layout to apply
        Returns:
        buffer adapter
      • create

        public static <S extends DataBuffer<?>> DoubleDataBuffer create​(S buffer,
                                                                        DoubleDataLayout<S> layout)
        Creates an adapter that applies a double data layout to the given buffer.
        Type Parameters:
        S - the type of the buffer
        Parameters:
        buffer - the delegate buffer
        layout - layout to apply
        Returns:
        buffer adapter
      • create

        public static <S extends DataBuffer<?>> FloatDataBuffer create​(S buffer,
                                                                       FloatDataLayout<S> layout)
        Creates an adapter that applies a float data layout to the given buffer.
        Type Parameters:
        S - the type of the buffer
        Parameters:
        buffer - the delegate buffer
        layout - layout to apply
        Returns:
        buffer adapter
      • create

        public static <S extends DataBuffer<?>> IntDataBuffer create​(S buffer,
                                                                     IntDataLayout<S> layout)
        Creates an adapter that applies a integer data layout to the given buffer.
        Type Parameters:
        S - the type of the buffer
        Parameters:
        buffer - the delegate buffer
        layout - layout to apply
        Returns:
        buffer adapter
      • create

        public static <S extends DataBuffer<?>> LongDataBuffer create​(S buffer,
                                                                      LongDataLayout<S> layout)
        Creates an adapter that applies a long data layout to the given buffer.
        Type Parameters:
        S - the type of the buffer
        Parameters:
        buffer - the delegate buffer
        layout - layout to apply
        Returns:
        buffer adapter
      • create

        public static <S extends DataBuffer<?>> ShortDataBuffer create​(S buffer,
                                                                       ShortDataLayout<S> layout)
        Creates an adapter that applies a short data layout to the given buffer.
        Type Parameters:
        S - the type of the buffer
        Parameters:
        buffer - the delegate buffer
        layout - layout to apply
        Returns:
        buffer adapter
      • create

        public static <S extends DataBuffer<?>,​T> DataBuffer<T> create​(S buffer,
                                                                             DataLayout<S,​T> layout)
        Creates an adapter that applies a data layout to the given buffer.
        Type Parameters:
        S - the type of the buffer
        T - the type of data returned by the layout
        Parameters:
        buffer - the delegate buffer
        layout - layout to apply
        Returns:
        buffer adapter