001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.harmony.luni.platform;
019:
020: import java.io.FileDescriptor;
021: import java.io.FileNotFoundException;
022: import java.io.IOException;
023:
024: /**
025: * TODO Type description
026: *
027: */
028: public interface IFileSystem extends ISystemComponent {
029:
030: public final int SHARED_LOCK_TYPE = 1;
031:
032: public final int EXCLUSIVE_LOCK_TYPE = 2;
033:
034: public final int SEEK_SET = 1;
035:
036: public final int SEEK_CUR = 2;
037:
038: public final int SEEK_END = 4;
039:
040: public final int O_RDONLY = 0x00000000;
041:
042: public final int O_WRONLY = 0x00000001;
043:
044: public final int O_RDWR = 0x00000010;
045:
046: public final int O_RDWRSYNC = 0x00000020;
047:
048: public final int O_APPEND = 0x00000100;
049:
050: public final int O_CREAT = 0x00001000;
051:
052: public final int O_EXCL = 0x00010000;
053:
054: public final int O_NOCTTY = 0x00100000;
055:
056: public final int O_NONBLOCK = 0x01000000;
057:
058: public final int O_TRUNC = 0x10000000;
059:
060: public long read(long fileDescriptor, byte[] bytes, int offset,
061: int length) throws IOException;
062:
063: public long write(long fileDescriptor, byte[] bytes, int offset,
064: int length) throws IOException;
065:
066: public long readv(long fileDescriptor, long[] addresses,
067: int[] offsets, int[] lengths, int size) throws IOException;
068:
069: public long writev(long fileDescriptor, long[] addresses,
070: int[] offsets, int[] lengths, int size) throws IOException;
071:
072: // Required to support direct byte buffers
073: public long readDirect(long fileDescriptor, long address,
074: int offset, int length) throws IOException;
075:
076: public long writeDirect(long fileDescriptor, long address,
077: int offset, int length) throws IOException;
078:
079: public boolean lock(long fileDescriptor, long start, long length,
080: int type, boolean waitFlag) throws IOException;
081:
082: public void unlock(long fileDescriptor, long start, long length)
083: throws IOException;
084:
085: public long seek(long fileDescriptor, long offset, int whence)
086: throws IOException;
087:
088: public void fflush(long fileDescriptor, boolean metadata)
089: throws IOException;
090:
091: public void close(long fileDescriptor) throws IOException;
092:
093: public void truncate(long fileDescriptor, long size)
094: throws IOException;
095:
096: /**
097: * Returns the granularity for virtual memory allocation.
098: */
099: public int getAllocGranularity() throws IOException;
100:
101: public long open(byte[] fileName, int mode)
102: throws FileNotFoundException;
103:
104: public long transfer(long fileHandler,
105: FileDescriptor socketDescriptor, long offset, long count)
106: throws IOException;
107:
108: public long ttyAvailable() throws IOException;
109:
110: public long ttyRead(byte[] bytes, int offset, int length)
111: throws IOException;
112: }
|