All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bumptech.glide.load.resource.bytes.ByteBufferRewinder Maven / Gradle / Ivy

Go to download

A fast and efficient image loading library for Android focused on smooth scrolling.

The newest version!
package com.bumptech.glide.load.resource.bytes;

import androidx.annotation.NonNull;
import com.bumptech.glide.load.data.DataRewinder;
import java.nio.ByteBuffer;

/** Rewinds {@link java.nio.ByteBuffer}s. */
public class ByteBufferRewinder implements DataRewinder {
  private final ByteBuffer buffer;

  // Public API.
  @SuppressWarnings("WeakerAccess")
  public ByteBufferRewinder(ByteBuffer buffer) {
    this.buffer = buffer;
  }

  @NonNull
  @Override
  public ByteBuffer rewindAndGet() {
    buffer.position(0);
    return buffer;
  }

  @Override
  public void cleanup() {
    // Do nothing.
  }

  /** Factory for {@link com.bumptech.glide.load.resource.bytes.ByteBufferRewinder}. */
  public static class Factory implements DataRewinder.Factory {

    @NonNull
    @Override
    public DataRewinder build(ByteBuffer data) {
      return new ByteBufferRewinder(data);
    }

    @NonNull
    @Override
    public Class getDataClass() {
      return ByteBuffer.class;
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy