com.bumptech.glide.load.resource.bytes.ByteBufferRewinder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of glide Show documentation
Show all versions of glide Show documentation
A fast and efficient image loading library for Android focused on smooth scrolling.
package com.bumptech.glide.load.resource.bytes;
import com.bumptech.glide.load.data.DataRewinder;
import java.io.IOException;
import java.nio.ByteBuffer;
/**
* Rewinds {@link java.nio.ByteBuffer}s.
*/
public class ByteBufferRewinder implements DataRewinder {
private final ByteBuffer buffer;
public ByteBufferRewinder(ByteBuffer buffer) {
this.buffer = buffer;
}
@Override
public ByteBuffer rewindAndGet() throws IOException {
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 {
@Override
public DataRewinder build(ByteBuffer data) {
return new ByteBufferRewinder(data);
}
@Override
public Class getDataClass() {
return ByteBuffer.class;
}
}
}