Пример #1
0
 public long length() {
   try {
     return image.length();
   } catch (IOException e) {
     return -1L;
   }
 }
Пример #2
0
 public int write(byte[] data, int offset, int length) throws IOException {
   image.write(data, offset, length);
   return length;
 }
Пример #3
0
 public void seek(long offset) throws IOException {
   image.seek(offset);
 }
Пример #4
0
 public void close() throws IOException {
   image.close();
 }
Пример #5
0
 public int read(byte[] data, int offset, int length) throws IOException {
   return image.read(data, offset, length);
 }
Пример #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();
 }