1package dev.advo.fs.net.ondemand;
4import org.jboss.netty.buffer.ChannelBuffer;
5import org.jboss.netty.channel.Channel;
6import org.jboss.netty.channel.ChannelHandlerContext;
7import org.jboss.netty.handler.codec.frame.FrameDecoder;
9import dev.advo.fs.fs.FileDescriptor;
14 protected Object
decode(ChannelHandlerContext ctx, Channel c, ChannelBuffer buf)
throws Exception {
18 if (buf.readableBytes() >= 4) {
19 int check = buf.readUnsignedByte();
21 System.out.println(
"corrupted request " + check);
26 int hashed = buf.readMedium();
27 int type =
index(hashed);
29 System.out.println(
"requesting file " + type +
" - " +
file);
38 public static int index(
int pair) {
42 public static int file(
int pair) {
43 return pair >>> 5 & 0x7FFFF;
A class which points to a file in the cache.
Object decode(ChannelHandlerContext ctx, Channel c, ChannelBuffer buf)
static int file(int pair)
static int index(int pair)