1 32 package com.imagero.uio.buffer; 33 34 import java.io.IOException ; 35 import java.io.RandomAccessFile ; 36 37 44 public class MutableRAFBufferManager extends RAFBufferManager implements MutableBufferManager { 45 46 public MutableRAFBufferManager(RandomAccessFile raf) throws IOException { 47 this(raf, 0); 48 } 49 50 public MutableRAFBufferManager(RandomAccessFile raf, long offset) throws IOException { 51 this(raf, offset, raf.length()); 52 } 53 54 59 public MutableRAFBufferManager(RandomAccessFile raf, long offset, long length) { 60 this(raf, offset, length, defaultBufferSize); 61 } 62 63 70 public MutableRAFBufferManager(RandomAccessFile raf, long offset, long length, int bufferLength) { 71 super(raf, offset, length, bufferLength); 72 73 Buffer buffer = createBuffer(raf, offset, bufferLength); 74 accessManager.put(new Integer (0), buffer); 75 } 76 77 protected Buffer createBuffer(RandomAccessFile ro, long offset, int bufferLength) { 78 return new RAFBuffer(ro, offset, bufferLength); 79 } 80 81 public void clear() { 82 try { 83 flush(); 84 } 85 catch (IOException ex) { 86 ex.printStackTrace(); 87 } 88 super.clear(); 89 } 90 } 91 | Popular Tags |