Exemplo n.º 1
0
 public long length() {
   try {
     return image.length();
   } catch (IOException e) {
     return -1L;
   }
 }
Exemplo n.º 2
0
 public int write(byte[] data, int offset, int length) throws IOException {
   image.write(data, offset, length);
   return length;
 }
Exemplo n.º 3
0
 public void seek(long offset) throws IOException {
   image.seek(offset);
 }
Exemplo n.º 4
0
 public void close() throws IOException {
   image.close();
 }
Exemplo n.º 5
0
 public int read(byte[] data, int offset, int length) throws IOException {
   return image.read(data, offset, length);
 }
Exemplo n.º 6
0
 public static FileLock lock_file(String path) throws IOException, FileNotFoundException {
   RandomAccessFile file = new RandomAccessFile(path, "rw");
   FileChannel fileChannel = file.getChannel();
   return fileChannel.tryLock();
 }