public class MemCachedManagerTest {
private static MemCachedManager cache;
private byte data[];
@Test
public void insertImage() throws Exception{
File image=new File("C:\\Users\\Administrator\\Desktop\\1.png");
InputStream input=new FileInputStream(image);
data=new byte[1024];
List<byte[]> list =new ArrayList<byte[]>();
int length=-1;
while((length=input.read(data))!=-1){
if(length<1024){
byte data2[]=new byte[length];
for(int i=0;i<length;i++){
data2[i]=data[i];
}
data=data2;
}
list.add(data);
for(int m=0;m<data.length;m++){
System.out.print(data[m]);
}
System.out.println();
}
cache.add("image", list);
}
static{
cache = MemCachedManager.getInstance();
}
}
这段代码中隐含一个错误