예제 #1
0
 private CodecPage getPage(int pageIndex) {
   if (!pages.containsKey(pageIndex) || pages.get(pageIndex).get() == null) {
     pages.put(pageIndex, new SoftReference<CodecPage>(document.getPage(pageIndex)));
     pageEvictionQueue.remove(pageIndex);
     pageEvictionQueue.offer(pageIndex);
     if (pageEvictionQueue.size() > PAGE_POOL_SIZE) {
       Integer evictedPageIndex = pageEvictionQueue.poll();
       CodecPage evictedPage = pages.remove(evictedPageIndex).get();
       if (evictedPage != null) {
         evictedPage.recycle();
       }
     }
   }
   return pages.get(pageIndex).get();
 }
예제 #2
0
 public int getPageCount() {
   return document.getPageCount();
 }