importjava.io.ByteArrayOutputStream;importjava.io.File;importjava.io.FileOutputStream;importjava.io.IOException;importjava.io.ObjectOutputStream;importjava.util.Queue;importjava.util.Scanner;importjava.util.concurrent.ArrayBlockingQueue;importcom.idealisan.structure.ArrayBlockingByteValueQueue;public classTestMen {static int capacity = 1024 * 1024 * 10;public static voidmain(String[] args) {
ArrayBlockingQueue pointerQueue = new ArrayBlockingQueue(capacity);
ArrayBlockingByteValueQueue valueQueue= newArrayBlockingByteValueQueue(capacity);
fillQueue(valueQueue);
FileOutputStream os;try{
os= new FileOutputStream(new File("F:/ttt/value10.dat"));
ObjectOutputStream oos= newObjectOutputStream(os);
oos.writeObject(valueQueue);
oos.flush();
oos.close();
os.flush();
os.close();
}catch(Exception e) {//TODO Auto-generated catch block
e.printStackTrace();
}
valueQueue= null;
fillQueue(pointerQueue);try{
os= new FileOutputStream(new File("F:/ttt/pointer10.dat"));
ObjectOutputStream oos= newObjectOutputStream(os);
oos.writeObject(pointerQueue);
oos.flush();
oos.close();
os.flush();
os.close();
}catch(Exception e) {//TODO Auto-generated catch block
e.printStackTrace();
}
pointerQueue= null;
}private static void fillQueue(Queuequeue) {while (queue.size()
queue.offer(new Byte((byte) 1));
}
}
}