diff --git a/group24/798277403/src/week1/LinkedList.java b/group24/798277403/src/week1/LinkedList.java index d0933cfcb1..e0160d0e5f 100644 --- a/group24/798277403/src/week1/LinkedList.java +++ b/group24/798277403/src/week1/LinkedList.java @@ -158,4 +158,77 @@ private static class Node{ this.value = e; } } + + /** + * 把该链表逆置 + * 例如链表为 3->7->10 , 逆置后变为 10->7->3 + */ + public void reverse(){ + + } + + /** + * 删除一个单链表的前半部分 + * 例如:list = 2->5->7->8 , 删除以后的值为 7->8 + * 如果list = 2->5->7->8->10 ,删除以后的值为7,8,10 + */ + public void removeFirstHalf(){ + + } + + /** + * 从第i个元素开始, 删除length 个元素 , 注意i从0开始 + * @param i + * @param length + */ + public void remove(int i, int length){ + + } + /** + * 假定当前链表和listB均包含已升序排列的整数 + * 从当前链表中取出那些listB所指定的元素 + * 例如当前链表 = 11->101->201->301->401->501->601->701 + * listB = 1->3->4->6 + * 返回的结果应该是[101,301,401,601] + * @param list + */ + public int[] getElements(LinkedList list){ + return null; + } + + /** + * 已知链表中的元素以值递增有序排列,并以单链表作存储结构。 + * 从当前链表中中删除在listB中出现的元素 + * @param list + */ + public void subtract(LinkedList list){ + + } + + /** + * 已知当前链表中的元素以值递增有序排列,并以单链表作存储结构。 + * 删除表中所有值相同的多余元素(使得操作后的线性表中所有元素的值均不相同) + */ + public void removeDuplicateValues(){ + + } + + /** + * 已知链表中的元素以值递增有序排列,并以单链表作存储结构。 + * 试写一高效的算法,删除表中所有值大于min且小于max的元素(若表中存在这样的元素) + * @param min + * @param max + */ + public void removeRange(int min, int max){ + + } + + /** + * 假设当前链表和参数list指定的链表均以元素依值递增有序排列(同一表中的元素值各不相同) + * 现要求生成新链表C,其元素为当前链表和list中元素的交集,且表C中的元素有依值递增有序排列 + * @param list + */ + public LinkedList intersection( LinkedList list){ + return null; + } } diff --git a/group24/798277403/src/week3/DownloadThread.java b/group24/798277403/src/week3/DownloadThread.java new file mode 100644 index 0000000000..6361f6b394 --- /dev/null +++ b/group24/798277403/src/week3/DownloadThread.java @@ -0,0 +1,50 @@ +package week3; + + +import week3.api.Connection; + +import java.io.RandomAccessFile; +import java.util.concurrent.CyclicBarrier; + +class DownloadThread extends Thread{ + + private Connection conn; + private int startPos; + private int endPos; + private CyclicBarrier barrier; + private String localFile; + public DownloadThread( Connection conn, int startPos, int endPos, String localFile, CyclicBarrier barrier){ + + this.conn = conn; + this.startPos = startPos; + this.endPos = endPos; + this.localFile = localFile; + this.barrier = barrier; + } + public void run(){ + + + try { + System.out.println("Begin to read [" + startPos +"-"+endPos+"]"); + + byte[] data = conn.read(startPos, endPos); + + RandomAccessFile file = new RandomAccessFile(localFile,"rw"); + + file.seek(startPos); + + file.write(data); + + file.close(); + + conn.close(); + + barrier.await(); //等待别的线程完成 + + } catch (Exception e) { + e.printStackTrace(); + + } + + } +} diff --git a/group24/798277403/src/week3/FileDownloader.java b/group24/798277403/src/week3/FileDownloader.java new file mode 100644 index 0000000000..912fc47df3 --- /dev/null +++ b/group24/798277403/src/week3/FileDownloader.java @@ -0,0 +1,116 @@ +package week3; + + +import week3.api.Connection; +import week3.api.ConnectionManager; +import week3.api.DownloadListener; + +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.concurrent.CyclicBarrier; + +public class FileDownloader { + + private String url; + private String localFile; + + DownloadListener listener; + + ConnectionManager cm; + + + private static final int DOWNLOAD_TRHEAD_NUM = 3; + + public FileDownloader(String _url, String localFile) { + this.url = _url; + this.localFile = localFile; + + } + + public void execute(){ + // 在这里实现你的代码, 注意: 需要用多线程实现下载 + // 这个类依赖于其他几个接口, 你需要写这几个接口的实现代码 + // (1) ConnectionManager , 可以打开一个连接,通过Connection可以读取其中的一段(用startPos, endPos来指定) + // (2) DownloadListener, 由于是多线程下载, 调用这个类的客户端不知道什么时候结束,所以你需要实现当所有 + // 线程都执行完以后, 调用listener的notifiedFinished方法, 这样客户端就能收到通知。 + // 具体的实现思路: + // 1. 需要调用ConnectionManager的open方法打开连接, 然后通过Connection.getContentLength方法获得文件的长度 + // 2. 至少启动3个线程下载, 注意每个线程需要先调用ConnectionManager的open方法 + // 然后调用read方法, read方法中有读取文件的开始位置和结束位置的参数, 返回值是byte[]数组 + // 3. 把byte数组写入到文件中 + // 4. 所有的线程都下载完成以后, 需要调用listener的notifiedFinished方法 + + // 下面的代码是示例代码, 也就是说只有一个线程, 你需要改造成多线程的。 + + CyclicBarrier barrier = new CyclicBarrier(DOWNLOAD_TRHEAD_NUM , new Runnable(){ + public void run(){ + listener.notifyFinished(); + } + }); + + Connection conn = null; + try { + conn = cm.open(this.url); + int length = conn.getContentLength(); + createPlaceHolderFile(this.localFile, length); + int[][] ranges = allocateDownloadRange(DOWNLOAD_TRHEAD_NUM, length); + for(int i=0; i< DOWNLOAD_TRHEAD_NUM; i++){ + DownloadThread thread = new DownloadThread( + cm.open(url), + ranges[i][0], + ranges[i][1], + localFile, + barrier); + thread.start(); + } + } catch (Exception e) { + e.printStackTrace(); + }finally{ + if(conn != null){ + conn.close(); + } + } + } + + //往文件里面写0,占住磁盘 + private void createPlaceHolderFile(String fileName, int contentLen) throws IOException { + RandomAccessFile file = new RandomAccessFile(fileName,"rw"); + for(int i=0; i totalLen){ + byte[] data = baos.toByteArray(); + return Arrays.copyOf(data, totalLen); + } + return baos.toByteArray(); + } + + @Override + public int getContentLength() { + URLConnection con; + try { + con = url.openConnection(); + return con.getContentLength(); + } catch (IOException e) { + e.printStackTrace(); + } + return -1; + } + + @Override + public void close() { + + } + +} diff --git a/group24/798277403/src/week3/impl/ConnectionManagerImpl.java b/group24/798277403/src/week3/impl/ConnectionManagerImpl.java new file mode 100644 index 0000000000..130d7e5aaa --- /dev/null +++ b/group24/798277403/src/week3/impl/ConnectionManagerImpl.java @@ -0,0 +1,14 @@ +package week3.impl; + +import week3.api.Connection; +import week3.api.ConnectionException; +import week3.api.ConnectionManager; + +public class ConnectionManagerImpl implements ConnectionManager { + + @Override + public Connection open(String url) throws ConnectionException { + return new ConnectionImpl(url); + } + +} diff --git a/group24/798277403/src/week3/linkedlist/LinkedList.java b/group24/798277403/src/week3/linkedlist/LinkedList.java new file mode 100644 index 0000000000..ad4560ad7d --- /dev/null +++ b/group24/798277403/src/week3/linkedlist/LinkedList.java @@ -0,0 +1,360 @@ +package week3.linkedlist; + + +/** + * 自己实现的LinkedList + * Created by zhouliang on 2017-03-10. + */ +class LinkedList implements List{ + + private int size; + private Node first; + private Node last; + + public LinkedList(){ + } + + @Override + public void add(E e) { + Node temp = new Node(e); + if(first != null){ + last.next = temp; + last = temp; + }else{ + first = temp; + last = temp; + } + size++; + } + + /** + * 指定下标添加元素 + * @param index 可以在链表末尾加,就是可以的等于size,不能大于size + * @param e 代表Element + */ + @Override + public void add(int index, E e) { + checkPositionIndex(index); + + Node temp = new Node(e); + if(index == size){ + last.next = temp; + last = temp; + }else{ + Node begin = first; + index--; + while(index>0){ + begin = begin.next; + index--; + } + Node next = begin.next; + begin.next = temp; + temp.next = next; + } + size++; + } + + @Override + public E get(int index) { + checkElementIndex(index); + + Node temp = first; + while(index>0){ + temp = temp.next; + index--; + } + return temp.value; + } + + @Override + public E remove(int index) { + checkElementIndex(index); + + Node temp; + if(index == 0){ + temp = first; + first = first.next; + size--; + return temp.value; + }else{ + temp = first; + index--; + //找到要删除节点的前一个节点 + while(index>0){ + temp = temp.next; + index--; + } + Node removeNode = temp.next; + temp.next = removeNode.next; + size--; + return removeNode.value; + + } + + } + + public E removeLast(){ + return remove(size-1); + } + + public void addFirst(E e){ + Node temp = new Node(e); + if(first == null){ + first = temp; + last = temp; + }else{ + temp.next = first; + first = temp; + } + size++; + } + + public void addLast(E e){ + Node temp = new Node(); + if(first == null){ + first = temp; + last = temp; + }else{ + last.next = temp; + last = temp; + } + size++; + } + + //检查index是否是合法的get下标 + private void checkElementIndex(int index) { + if (!isElementIndex(index)) { + throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + + size); + } + } + + private boolean isElementIndex(int index) { + return index >= 0 && index < size; + } + + //检查index是否是合法的add下标 + private void checkPositionIndex(int index) { + if (!isPositionIndex(index)) { + throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + + size); + } + } + + private boolean isPositionIndex(int index) { + return index >= 0 && index <= size; + } + + @Override + public int size() { + return size; + } + + private static class Node{ + E value; + Node next; + Node(){ + } + Node(E e){ + this.value = e; + } + } + + + /** + * 把该链表逆置 + * 例如链表为 3->7->10 , 逆置后变为 10->7->3 + */ + public void reverse(){ + Node preNode = first; + + //头尾结点互换位置 + Node node = last; + last = first; + first = node; + + node = preNode.next; + Node nextNode; + + while (node != null) { + nextNode = node.next; + node.next = preNode; + preNode = node; + node = nextNode; + } + } + + /** + * 删除一个单链表的前半部分 + * 例如:list = 2->5->7->8 , 删除以后的值为 7->8 + * 如果list = 2->5->7->8->10 ,删除以后的值为7,8,10 + */ + public void removeFirstHalf(){ + int num = this.size/2; + this.size = this.size - num; + while(num>0){ + //Node temp = first.next; + first = first.next; + num--; + } + } + + /** + * 从第i个元素开始, 删除length 个元素 , 注意i从0开始 + * @param i + * @param length + */ + public void remove(int i, int length){ + checkPositionIndex(i); + if(length+i>size-1){ + throw new IndexOutOfBoundsException("Index: " + (i+length) + ", Size: " + + size); + } + int temp = 0; + Node newFirst = first; + Node beginNode = newFirst; + while(temp < i){ + beginNode = beginNode.next; + temp++; + } + Node endNode = beginNode.next; + size = size - length; + while(length>0){ + endNode = endNode.next; + length--; + } + first = newFirst; + beginNode.next = endNode; + } + + /** + * 假定当前链表和listB均包含已升序排列的整数 + * 从当前链表中取出那些listB所指定的元素 + * 例如当前链表 = 11->101->201->301->401->501->601->701 + * listB = 1->3->4->6 + * 返回的结果应该是[101,301,401,601] + * @param list + */ + public int[] getElements(LinkedList list){ + if(list==null || list.size()==0){ + return null; + }else{ + int[] result = new int[list.size()]; + int index = 0; + int length = 0; + Node temp = first; + for (int i=0; imin && (Integer)temp.value myLinkedList = new week3.linkedlist.LinkedList<>(); + + private java.util.LinkedList systemLinkedList = new java.util.LinkedList<>(); + + @Before + public void setUp(){ + for(int i=0; i<10; i++){ + myLinkedList.add(i); + systemLinkedList.add(i); + } + } + @Test + public void add() throws Exception { + for(int i=0; i<10; i++){ + System.out.println(myLinkedList.get(i)); + } + } + + @Test + public void reverse(){ + myLinkedList.reverse(); + for(int i=0; i<10; i++){ + System.out.println(myLinkedList.get(i)); + } + } + + @Test + public void removeFirstHalf(){ + myLinkedList.removeFirstHalf(); + System.out.println(myLinkedList.size()); + for(int i=0; i list = new LinkedList(); + list.add(0); + list.add(7); + list.add(9); + int[] reuslt = myLinkedList.getElements(list); + System.out.println(reuslt.length); + for(int i=0; i list = new LinkedList(); + list.add(0); + list.add(7); + list.add(9); + myLinkedList.subtract(list); + for(int i=0; i list = new LinkedList(); + list.add(0); + list.add(2); + list.add(9); + list.add(9); + list.add(9); + list.add(9); + list.add(9); + list.add(9); + list.add(9); + + + + LinkedList result = myLinkedList.intersection(list); + for(int i=0; i { + void add(E e); + void add(int index, E e); + E get(int index); + E remove(int index); + int size(); +} diff --git a/group24/798277403/src/week3/test/ConnectionTest.java b/group24/798277403/src/week3/test/ConnectionTest.java new file mode 100644 index 0000000000..918f4d0707 --- /dev/null +++ b/group24/798277403/src/week3/test/ConnectionTest.java @@ -0,0 +1,52 @@ +package week3.test; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import week3.api.Connection; +import week3.api.ConnectionManager; +import week3.impl.ConnectionManagerImpl; + + +public class ConnectionTest { + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testContentLength() throws Exception{ + ConnectionManager connMan = new ConnectionManagerImpl(); + Connection conn = connMan.open("http://www.hinews.cn/pic/0/13/91/26/13912621_821796.jpg"); + Assert.assertEquals(35470, conn.getContentLength()); + } + + @Test + public void testRead() throws Exception{ + + ConnectionManager connMan = new ConnectionManagerImpl(); + Connection conn = connMan.open("http://www.hinews.cn/pic/0/13/91/26/13912621_821796.jpg"); + + byte[] data = conn.read(0, 35469); + + Assert.assertEquals(35470, data.length); + + data = conn.read(0, 1023); + + Assert.assertEquals(1024, data.length); + + data = conn.read(1024, 2023); + + Assert.assertEquals(1000, data.length); + + + // 测试不充分,没有断言内容是否正确 + } + + +} diff --git a/group24/798277403/src/week3/test/FileDownloaderTest.java b/group24/798277403/src/week3/test/FileDownloaderTest.java new file mode 100644 index 0000000000..959796399b --- /dev/null +++ b/group24/798277403/src/week3/test/FileDownloaderTest.java @@ -0,0 +1,62 @@ +package week3.test; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import week3.FileDownloader; +import week3.api.ConnectionManager; +import week3.api.DownloadListener; +import week3.impl.ConnectionManagerImpl; + + +public class FileDownloaderTest { + boolean downloadFinished = false; + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testDownload() { + + //String url = "http://www.hinews.cn/pic/0/13/91/26/13912621_821796.jpg"; + + String url = "http://images2015.cnblogs.com/blog/610238/201604/610238-20160421154632101-286208268.png"; + + FileDownloader downloader = new FileDownloader(url,"C:\\Users\\zhouliang\\Desktop\\mycoding\\test.jpg"); + + + ConnectionManager cm = new ConnectionManagerImpl(); + downloader.setConnectionManager(cm); + + downloader.setListener(new DownloadListener() { + @Override + public void notifyFinished() { + downloadFinished = true; + } + + }); + + + downloader.execute(); + + // 等待多线程下载程序执行完毕 + while (!downloadFinished) { + try { + System.out.println("还没有下载完成,休眠五秒"); + //休眠5秒 + Thread.sleep(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + System.out.println("下载完成!"); + + + + } + +} diff --git a/group24/798277403/src/week4/LRU/LRUPageFrame.java b/group24/798277403/src/week4/LRU/LRUPageFrame.java new file mode 100644 index 0000000000..cbbb26fc7f --- /dev/null +++ b/group24/798277403/src/week4/LRU/LRUPageFrame.java @@ -0,0 +1,130 @@ +package week4.LRU; + +/** + * Created by zhouliang on 2017-04-04. + */ +public class LRUPageFrame { + private static class Node { + Node prev; + Node next; + int pageNum; + Node() { + } + } + + private int capacity; + + private int currentSize; + private Node first;// 链表头 + private Node last;// 链表尾 + + + public LRUPageFrame(int capacity) { + this.currentSize = 0; + this.capacity = capacity; + } + + /** + * 获取缓存中对象 + * @param pageNum + * @return + */ + public void access(int pageNum) { + Node node = find(pageNum); + //在该队列中存在, 则提到队列头 + if (node != null) { + moveExistingNodeToHead(node); + } else{ + node = new Node(); + node.pageNum = pageNum; + // 缓存容器是否已经超过大小. + if (currentSize >= capacity) { + removeLast(); + } + addNewNodetoHead(node); + } + } + + private void addNewNodetoHead(Node node) { + if(isEmpty()){ + node.prev = null; + node.next = null; + first = node; + last = node; + + } else{ + node.prev = null; + node.next = first; + first.prev = node; + first = node; + } + this.currentSize ++; + } + + private Node find(int data){ + Node node = first; + while(node != null){ + if(node.pageNum == data){ + return node; + } + node = node.next; + } + return null; + + } + + /** + * 删除链表尾部节点 表示 删除最少使用的缓存对象 + */ + private void removeLast() { + Node prev = last.prev; + prev.next = null; + last.prev = null; + last = prev; + this.currentSize --; + } + + /** + * 移动到链表头,表示这个节点是最新使用过的 + * + * @param node + */ + private void moveExistingNodeToHead(Node node) { + if (node == first) { + return; + } + else if(node == last){ + //当前节点是链表尾, 需要放到链表头 + Node prevNode = node.prev; + prevNode.next = null; + last.prev = null; + last = prevNode; + } else{ + //node 在链表的中间, 把node 的前后节点连接起来 + Node prevNode = node.prev; + prevNode.next = node.next; + Node nextNode = node.next; + nextNode.prev = prevNode; + } + node.prev = null; + node.next = first; + first.prev = node; + first = node; + } + private boolean isEmpty(){ + return (first == null) && (last == null); + } + + public String toString(){ + StringBuilder buffer = new StringBuilder(); + Node node = first; + while(node != null){ + buffer.append(node.pageNum); + node = node.next; + if(node != null){ + buffer.append(","); + } + } + return buffer.toString(); + } +} diff --git a/group24/798277403/src/week4/LRU/LRUPageFrameTest.java b/group24/798277403/src/week4/LRU/LRUPageFrameTest.java new file mode 100644 index 0000000000..0b6bdf2c25 --- /dev/null +++ b/group24/798277403/src/week4/LRU/LRUPageFrameTest.java @@ -0,0 +1,33 @@ +package week4.LRU; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Created by zhouliang on 2017-04-04. + */ +public class LRUPageFrameTest { + @Test + public void testAccess() { + MyLRUPageFrame frame = new MyLRUPageFrame(3); + frame.access(7); + frame.access(0); + frame.access(1); + Assert.assertEquals("1,0,7", frame.toString()); + frame.access(2); + Assert.assertEquals("2,1,0", frame.toString()); + frame.access(0); + Assert.assertEquals("0,2,1", frame.toString()); + frame.access(0); + Assert.assertEquals("0,2,1", frame.toString()); + frame.access(3); + Assert.assertEquals("3,0,2", frame.toString()); + frame.access(0); + Assert.assertEquals("0,3,2", frame.toString()); + frame.access(4); + Assert.assertEquals("4,0,3", frame.toString()); + frame.access(5); + Assert.assertEquals("5,4,0", frame.toString()); + + } +} diff --git a/group24/798277403/src/week4/LRU/MyLRUPageFrame.java b/group24/798277403/src/week4/LRU/MyLRUPageFrame.java new file mode 100644 index 0000000000..9e720d8589 --- /dev/null +++ b/group24/798277403/src/week4/LRU/MyLRUPageFrame.java @@ -0,0 +1,133 @@ +package week4.LRU; + +/** + * Created by zhouliang on 2017-04-04. + */ +public class MyLRUPageFrame { + private static class Node { + Node prev; + Node next; + int pageNum; + + Node() { + } + } + + private int capacity; + private int currentSize; + private Node first;// 链表头 + private Node last;// 链表尾 + + public MyLRUPageFrame(int capacity) { + this.currentSize = 0; + this.capacity = capacity; + } + + /** + * 获取缓存中对象 + * + * @param pageNum + * @return + */ + public void access(int pageNum) { + //1、是否为空号 + //2、不为空,查找后面有没有出现pageNum,如果出现则把pageNum结点移动到head + //3、如果没有出现pageNum,则判断栈是否满 + //4、如果栈没有满,则添加pageNum到head + //5、否则删除最后一个再添加pageNum到head + Node temp = find(pageNum); + if (temp != null) { + moveExistingNodeToHead(temp); + } else { + temp = new Node(); + temp.pageNum = pageNum; + if (currentSize >= capacity) { + removeLast(); + } + addNewNodetoHead(temp); + } + + } + + private void addNewNodetoHead(Node node) { + if(isEmpty()){ + node.prev = null; + node.next = null; + first = node; + last = node; + }else{ + node.prev = null; + node.next = first; + first.prev = node; + first = node; + } + currentSize++; + } + + private Node find(int data) { + if (isEmpty()) { + return null; + } else { + Node temp = first; + while (temp.next != null) { + if (temp.pageNum == data) { + return temp; + } + temp = temp.next; + } + return null; + } + } + + /** + * 删除链表尾部节点 表示 删除最少使用的缓存对象 + */ + private void removeLast() { + Node temp = last.prev; + temp.next = null; + last.prev = null; + last = temp; + currentSize--; + } + + /** + * 移动到链表头,表示这个节点是最新使用过的 + */ + private void moveExistingNodeToHead(Node node) { + if(node == first){ + return; + } + if(node != last){ + Node prev = node.prev; + Node next = node.next; + prev.next = next; + next.prev = prev; + }else{ + Node prev = node.prev; + prev.next = null; + last.prev = null; + last = prev; + } + node.next = first; + node.prev = null; + first.prev = node; + first = node; + } + + private boolean isEmpty() { + return (first == null) && (last == null); + } + + public String toString() { + StringBuilder buffer = new StringBuilder(); + Node node = first; + while (node != null) { + buffer.append(node.pageNum); + node = node.next; + if (node != null) { + buffer.append(","); + } + } + return buffer.toString(); + } +} diff --git a/group24/798277403/src/week4/loader/ClassFileLoader.java b/group24/798277403/src/week4/loader/ClassFileLoader.java new file mode 100644 index 0000000000..90bce86e77 --- /dev/null +++ b/group24/798277403/src/week4/loader/ClassFileLoader.java @@ -0,0 +1,67 @@ +package week4.loader; + +import java.io.*; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by zhouliang on 2017-04-04. + */ +public class ClassFileLoader { + private List clzPaths = new ArrayList(); + + public byte[] readBinaryCode(String className) { + className = className.replace(".","\\"); + if(!className.endsWith(".class")){ + className=className+".class"; + } + File file = null; + for(String path : clzPaths){ + file = new File(path+"\\"+className); + if(file.exists()){ + break; + } + } + + if(file==null){ + try { + throw new FileNotFoundException(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + return null; + }else{ + byte[] buffer = new byte[1024]; + BufferedInputStream bufferedInputStream = null; + ByteArrayOutputStream byteArrayOutputStream = null; + try { + bufferedInputStream = new BufferedInputStream(new FileInputStream(file)); + byteArrayOutputStream = new ByteArrayOutputStream(); + int length = 0; + while((length = bufferedInputStream.read(buffer))!= -1){ + byteArrayOutputStream.write(buffer,0,length); + } + } catch (IOException e) { + e.printStackTrace(); + } + return byteArrayOutputStream.toByteArray(); + } + } + + + public void addClassPath(String path) { + clzPaths.add(path); + } + + public String getClassPath(){ + StringBuilder stringBuilder = new StringBuilder(); + for(int i=0; i