Debian Codegraph @

src/main/org/h2/store/fs/FileBase.java

raw
1 /*
2 * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,
3 * and the EPL 1.0 (https://h2database.com/html/license.html).
4 * Initial Developer: H2 Group
5 */
6 package org.h2.store.fs;
7
8 import java.io.IOException;
9 import java.nio.ByteBuffer;
10 import java.nio.MappedByteBuffer;
11 import java.nio.channels.FileChannel;
12 import java.nio.channels.FileLock;
13 import java.nio.channels.ReadableByteChannel;
14 import java.nio.channels.WritableByteChannel;
15
16 /**
17 * The base class for file implementations.
18 */
19 public abstract class FileBase extends FileChannel {
20
21 @Override
22 public synchronized int read(ByteBuffer dst, long position)
23 throws IOException {
24 long oldPos = position();
25 position(position);
26 int len = read(dst);
27 position(oldPos);
28 return len;
29 }
30
31 @Override
32 public synchronized int write(ByteBuffer src, long position)
33 throws IOException {
34 long oldPos = position();
35 position(position);
36 int len = write(src);
37 position(oldPos);
38 return len;
39 }
40
41 @Override
42 public void force(boolean metaData) throws IOException {
43 // ignore
44 }
45
46 @Override
47 protected void implCloseChannel() throws IOException {
48 // ignore
49 }
50
51 @Override
52 public FileLock lock(long position, long size, boolean shared)
53 throws IOException {
54 throw new UnsupportedOperationException();
55 }
56
57 @Override
58 public MappedByteBuffer map(MapMode mode, long position, long size)
59 throws IOException {
60 throw new UnsupportedOperationException();
61 }
62
63 @Override
64 public long read(ByteBuffer[] dsts, int offset, int length)
65 throws IOException {
66 throw new UnsupportedOperationException();
67 }
68
69 @Override
70 public long transferFrom(ReadableByteChannel src, long position, long count)
71 throws IOException {
72 throw new UnsupportedOperationException();
73 }
74
75 @Override
76 public long transferTo(long position, long count, WritableByteChannel target)
77 throws IOException {
78 throw new UnsupportedOperationException();
79 }
80
81 @Override
82 public FileLock tryLock(long position, long size, boolean shared)
83 throws IOException {
84 throw new UnsupportedOperationException();
85 }
86
87 @Override
88 public long write(ByteBuffer[] srcs, int offset, int length)
89 throws IOException {
90 throw new UnsupportedOperationException();
91 }
92
93 }