@@ -0,0 +1,1837 @@
+/**%0A * %0A */%0Apackage cn.strong.fastdfs.client.protocol.request.storage;%0A%0Aimport static cn.strong.fastdfs.client.CommandCodes.STORAGE_PROTO_CMD_DOWNLOAD_FILE;%0Aimport static cn.strong.fastdfs.client.Consts.ERRNO_OK;%0Aimport static cn.strong.fastdfs.client.Consts.FDFS_GROUP_LEN;%0Aimport static cn.strong.fastdfs.client.Consts.FDFS_LONG_LEN;%0Aimport static cn.strong.fastdfs.client.Consts.HEAD_LEN;%0Aimport static cn.strong.fastdfs.utils.Utils.writeFixLength;%0Aimport static io.netty.util.CharsetUtil.UTF_8;%0Aimport io.netty.buffer.ByteBuf;%0Aimport io.netty.buffer.ByteBufUtil;%0Aimport io.netty.channel.ChannelHandlerContext;%0A%0Aimport java.util.List;%0Aimport java.util.Objects;%0A%0Aimport cn.strong.fastdfs.client.protocol.request.Request;%0Aimport cn.strong.fastdfs.model.StoragePath;%0A%0A/**%0A * %E4%B8%8B%E8%BD%BD%E8%AF%B7%E6%B1%82%0A * %0A * @author liulongbiao%0A *%0A */%0Apublic class DownloadRequest implements Request %7B%0A%0A%09public static final int DEFAULT_OFFSET = 0;%0A%09public static final int SIZE_UNLIMIT = 0;%0A%0A%09public final StoragePath spath;%0A%09public final int offset;%0A%09public final int size;%0A%0A%09public DownloadRequest(StoragePath spath, int offset, int size) %7B%0A%09%09this.spath = Objects.requireNonNull(spath);%0A%09%09this.offset = offset;%0A%09%09this.size = size;%0A%09%7D%0A%0A%09public DownloadRequest(StoragePath spath) %7B%0A%09%09this(spath, DEFAULT_OFFSET, SIZE_UNLIMIT);%0A%09%7D%0A%0A%09@Override%0A%09public void encode(ChannelHandlerContext ctx, List%3CObject%3E out) %7B%0A%09%09byte%5B%5D pathBytes = spath.path.getBytes(UTF_8);%0A%09%09int length = 2 * FDFS_LONG_LEN + FDFS_GROUP_LEN + pathBytes.length;%0A%09%09byte cmd = STORAGE_PROTO_CMD_DOWNLOAD_FILE;%0A%09%09ByteBuf buf = ctx.alloc().buffer(length + HEAD_LEN);%0A%09%09buf.writeLong(length);%0A%09%09buf.writeByte(cmd);%0A%09%09buf.writeByte(ERRNO_OK);%0A%0A%09%09buf.writeLong(offset);%0A%09%09buf.writeLong(size);%0A%09%09writeFixLength(buf, spath.group, FDFS_GROUP_LEN, UTF_8);%0A%09%09ByteBufUtil.writeUtf8(buf, spath.path);%0A%09%09out.add(buf);%0A%09%7D%0A%0A%7D%0A

add Download