2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 // address length was changed from long to int for performance reasons.
22 package org.apache.harmony.luni.platform;
24 import java.io.FileDescriptor;
25 import java.io.FileNotFoundException;
26 import java.io.IOException;
29 * TODO Type description
32 public interface IFileSystem {
34 public final int SHARED_LOCK_TYPE = 1;
36 public final int EXCLUSIVE_LOCK_TYPE = 2;
38 public final int SEEK_SET = 1;
40 public final int SEEK_CUR = 2;
42 public final int SEEK_END = 4;
44 public final int O_RDONLY = 0x00000000;
46 public final int O_WRONLY = 0x00000001;
48 public final int O_RDWR = 0x00000010;
50 public final int O_RDWRSYNC = 0x00000020;
52 public final int O_APPEND = 0x00000100;
54 public final int O_CREAT = 0x00001000;
56 public final int O_EXCL = 0x00010000;
58 public final int O_NOCTTY = 0x00100000;
60 public final int O_NONBLOCK = 0x01000000;
62 public final int O_TRUNC = 0x10000000;
64 public long read(int fileDescriptor, byte[] bytes, int offset, int length)
67 public long write(int fileDescriptor, byte[] bytes, int offset, int length)
70 public long readv(int fileDescriptor, int[] addresses, int[] offsets,
71 int[] lengths, int size) throws IOException;
73 public long writev(int fileDescriptor, int[] addresses, int[] offsets,
74 int[] lengths, int size) throws IOException;
76 // Required to support direct byte buffers
77 public long readDirect(int fileDescriptor, int address, int offset,
78 int length) throws IOException;
80 public long writeDirect(int fileDescriptor, int address, int offset,
81 int length) throws IOException;
83 public long length(int fd);
85 public boolean lock(int fileDescriptor, long start, long length, int type,
86 boolean waitFlag) throws IOException;
88 public void unlock(int fileDescriptor, long start, long length)
91 public long seek(int fileDescriptor, long offset, int whence)
94 public void fsync(int fileDescriptor, boolean metadata) throws IOException;
96 public void truncate(int fileDescriptor, long size) throws IOException;
99 * Returns the granularity for virtual memory allocation.
101 public int getAllocGranularity() throws IOException;
103 public int open(String path, int mode) throws FileNotFoundException;
105 public long transfer(int fileHandler, FileDescriptor socketDescriptor,
106 long offset, long count) throws IOException;
108 // BEGIN android-deleted
109 // public long ttyAvailable() throws IOException;
110 // public long ttyRead(byte[] bytes, int offset, int length) throws IOException;
111 // END android-deleted
113 // BEGIN android-added
114 public int ioctlAvailable(FileDescriptor fileDescriptor) throws IOException;