mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-07 08:39:17 +00:00
Rename buf -> buffer, fixed documentation.
This commit is contained in:
@@ -39,10 +39,10 @@ public final class JagGrabRequestWorker extends RequestWorker<JagGrabRequest, Re
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void service(ResourceProvider provider, Channel channel, JagGrabRequest request) throws IOException {
|
protected void service(ResourceProvider provider, Channel channel, JagGrabRequest request) throws IOException {
|
||||||
Optional<ByteBuffer> buf = provider.get(request.getFilePath());
|
Optional<ByteBuffer> buffer = provider.get(request.getFilePath());
|
||||||
|
|
||||||
if (buf.isPresent()) {
|
if (buffer.isPresent()) {
|
||||||
ByteBuf wrapped = Unpooled.wrappedBuffer(buf.get());
|
ByteBuf wrapped = Unpooled.wrappedBuffer(buffer.get());
|
||||||
channel.writeAndFlush(new JagGrabResponse(wrapped)).addListener(ChannelFutureListener.CLOSE);
|
channel.writeAndFlush(new JagGrabResponse(wrapped)).addListener(ChannelFutureListener.CLOSE);
|
||||||
} else {
|
} else {
|
||||||
channel.close();
|
channel.close();
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public interface ResourceProvider {
|
|||||||
public boolean accept(String path) throws IOException;
|
public boolean accept(String path) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a resource as a {@link ByteBuffer} if it exists.
|
* The resource data, as a {@link ByteBuffer}, wrapped in an {@link Optional}.
|
||||||
*
|
*
|
||||||
* @param path The path to the resource.
|
* @param path The path to the resource.
|
||||||
* @return A {@code ByteBuffer} representation of a resource if it exists otherwise {@link Optional#empty()} is
|
* @return A {@code ByteBuffer} representation of a resource if it exists otherwise {@link Optional#empty()} is
|
||||||
|
|||||||
Reference in New Issue
Block a user