1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. Oracle designates this 9 * particular file as subject to the "Classpath" exception as provided 10 * by Oracle in the LICENSE file that accompanied this code. 11 * 12 * This code is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 * version 2 for more details (a copy is included in the LICENSE file that 16 * accompanied this code). 17 * 18 * You should have received a copy of the GNU General Public License version 19 * 2 along with this work; if not, write to the Free Software Foundation, 20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 * 22 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23 * or visit www.oracle.com if you need additional information or have any 24 * questions. 25 */ 26 27 package sun.nio.ch; 28 29 30 @SuppressWarnings({"unchecked", "deprecation", "all"}) 31 public class FileChannelImpl extends java.nio.channels.FileChannel { 32 FileChannelImpl( java.io.FileDescriptor fd, java.lang.String path, boolean readable, boolean writable, boolean append, java.lang.Object parent)33 private FileChannelImpl( 34 java.io.FileDescriptor fd, 35 java.lang.String path, 36 boolean readable, 37 boolean writable, 38 boolean append, 39 java.lang.Object parent) { 40 throw new RuntimeException("Stub!"); 41 } 42 open( java.io.FileDescriptor fd, java.lang.String path, boolean readable, boolean writable, java.lang.Object parent)43 public static java.nio.channels.FileChannel open( 44 java.io.FileDescriptor fd, 45 java.lang.String path, 46 boolean readable, 47 boolean writable, 48 java.lang.Object parent) { 49 throw new RuntimeException("Stub!"); 50 } 51 open( java.io.FileDescriptor fd, java.lang.String path, boolean readable, boolean writable, boolean append, java.lang.Object parent)52 public static java.nio.channels.FileChannel open( 53 java.io.FileDescriptor fd, 54 java.lang.String path, 55 boolean readable, 56 boolean writable, 57 boolean append, 58 java.lang.Object parent) { 59 throw new RuntimeException("Stub!"); 60 } 61 ensureOpen()62 private void ensureOpen() throws java.io.IOException { 63 throw new RuntimeException("Stub!"); 64 } 65 implCloseChannel()66 protected void implCloseChannel() throws java.io.IOException { 67 throw new RuntimeException("Stub!"); 68 } 69 finalize()70 protected void finalize() throws java.lang.Throwable { 71 throw new RuntimeException("Stub!"); 72 } 73 read(java.nio.ByteBuffer dst)74 public int read(java.nio.ByteBuffer dst) throws java.io.IOException { 75 throw new RuntimeException("Stub!"); 76 } 77 read(java.nio.ByteBuffer[] dsts, int offset, int length)78 public long read(java.nio.ByteBuffer[] dsts, int offset, int length) 79 throws java.io.IOException { 80 throw new RuntimeException("Stub!"); 81 } 82 write(java.nio.ByteBuffer src)83 public int write(java.nio.ByteBuffer src) throws java.io.IOException { 84 throw new RuntimeException("Stub!"); 85 } 86 write(java.nio.ByteBuffer[] srcs, int offset, int length)87 public long write(java.nio.ByteBuffer[] srcs, int offset, int length) 88 throws java.io.IOException { 89 throw new RuntimeException("Stub!"); 90 } 91 position()92 public long position() throws java.io.IOException { 93 throw new RuntimeException("Stub!"); 94 } 95 position(long newPosition)96 public java.nio.channels.FileChannel position(long newPosition) throws java.io.IOException { 97 throw new RuntimeException("Stub!"); 98 } 99 size()100 public long size() throws java.io.IOException { 101 throw new RuntimeException("Stub!"); 102 } 103 truncate(long newSize)104 public java.nio.channels.FileChannel truncate(long newSize) throws java.io.IOException { 105 throw new RuntimeException("Stub!"); 106 } 107 force(boolean metaData)108 public void force(boolean metaData) throws java.io.IOException { 109 throw new RuntimeException("Stub!"); 110 } 111 transferToDirectlyInternal( long position, int icount, java.nio.channels.WritableByteChannel target, java.io.FileDescriptor targetFD)112 private long transferToDirectlyInternal( 113 long position, 114 int icount, 115 java.nio.channels.WritableByteChannel target, 116 java.io.FileDescriptor targetFD) 117 throws java.io.IOException { 118 throw new RuntimeException("Stub!"); 119 } 120 transferToDirectly( long position, int icount, java.nio.channels.WritableByteChannel target)121 private long transferToDirectly( 122 long position, int icount, java.nio.channels.WritableByteChannel target) 123 throws java.io.IOException { 124 throw new RuntimeException("Stub!"); 125 } 126 transferToTrustedChannel( long position, long count, java.nio.channels.WritableByteChannel target)127 private long transferToTrustedChannel( 128 long position, long count, java.nio.channels.WritableByteChannel target) 129 throws java.io.IOException { 130 throw new RuntimeException("Stub!"); 131 } 132 transferToArbitraryChannel( long position, int icount, java.nio.channels.WritableByteChannel target)133 private long transferToArbitraryChannel( 134 long position, int icount, java.nio.channels.WritableByteChannel target) 135 throws java.io.IOException { 136 throw new RuntimeException("Stub!"); 137 } 138 transferTo(long position, long count, java.nio.channels.WritableByteChannel target)139 public long transferTo(long position, long count, java.nio.channels.WritableByteChannel target) 140 throws java.io.IOException { 141 throw new RuntimeException("Stub!"); 142 } 143 transferFromFileChannel(sun.nio.ch.FileChannelImpl src, long position, long count)144 private long transferFromFileChannel(sun.nio.ch.FileChannelImpl src, long position, long count) 145 throws java.io.IOException { 146 throw new RuntimeException("Stub!"); 147 } 148 transferFromArbitraryChannel( java.nio.channels.ReadableByteChannel src, long position, long count)149 private long transferFromArbitraryChannel( 150 java.nio.channels.ReadableByteChannel src, long position, long count) 151 throws java.io.IOException { 152 throw new RuntimeException("Stub!"); 153 } 154 transferFrom(java.nio.channels.ReadableByteChannel src, long position, long count)155 public long transferFrom(java.nio.channels.ReadableByteChannel src, long position, long count) 156 throws java.io.IOException { 157 throw new RuntimeException("Stub!"); 158 } 159 read(java.nio.ByteBuffer dst, long position)160 public int read(java.nio.ByteBuffer dst, long position) throws java.io.IOException { 161 throw new RuntimeException("Stub!"); 162 } 163 readInternal(java.nio.ByteBuffer dst, long position)164 private int readInternal(java.nio.ByteBuffer dst, long position) throws java.io.IOException { 165 throw new RuntimeException("Stub!"); 166 } 167 write(java.nio.ByteBuffer src, long position)168 public int write(java.nio.ByteBuffer src, long position) throws java.io.IOException { 169 throw new RuntimeException("Stub!"); 170 } 171 writeInternal(java.nio.ByteBuffer src, long position)172 private int writeInternal(java.nio.ByteBuffer src, long position) throws java.io.IOException { 173 throw new RuntimeException("Stub!"); 174 } 175 unmap(java.nio.MappedByteBuffer bb)176 private static void unmap(java.nio.MappedByteBuffer bb) { 177 throw new RuntimeException("Stub!"); 178 } 179 map( java.nio.channels.FileChannel.MapMode mode, long position, long size)180 public java.nio.MappedByteBuffer map( 181 java.nio.channels.FileChannel.MapMode mode, long position, long size) 182 throws java.io.IOException { 183 throw new RuntimeException("Stub!"); 184 } 185 isSharedFileLockTable()186 private static boolean isSharedFileLockTable() { 187 throw new RuntimeException("Stub!"); 188 } 189 fileLockTable()190 private sun.nio.ch.FileLockTable fileLockTable() throws java.io.IOException { 191 throw new RuntimeException("Stub!"); 192 } 193 lock(long position, long size, boolean shared)194 public java.nio.channels.FileLock lock(long position, long size, boolean shared) 195 throws java.io.IOException { 196 throw new RuntimeException("Stub!"); 197 } 198 tryLock(long position, long size, boolean shared)199 public java.nio.channels.FileLock tryLock(long position, long size, boolean shared) 200 throws java.io.IOException { 201 throw new RuntimeException("Stub!"); 202 } 203 release(sun.nio.ch.FileLockImpl fli)204 void release(sun.nio.ch.FileLockImpl fli) throws java.io.IOException { 205 throw new RuntimeException("Stub!"); 206 } 207 map0(int prot, long position, long length)208 private native long map0(int prot, long position, long length) throws java.io.IOException; 209 210 @android.compat.annotation.UnsupportedAppUsage unmap0(long address, long length)211 private static native int unmap0(long address, long length); 212 transferTo0( java.io.FileDescriptor src, long position, long count, java.io.FileDescriptor dst)213 private native long transferTo0( 214 java.io.FileDescriptor src, long position, long count, java.io.FileDescriptor dst); 215 position0(java.io.FileDescriptor fd, long offset)216 private native long position0(java.io.FileDescriptor fd, long offset); 217 initIDs()218 private static native long initIDs(); 219 220 private static final long MAPPED_TRANSFER_SIZE = 8388608L; // 0x800000L 221 222 private static final int MAP_PV = 2; // 0x2 223 224 private static final int MAP_RO = 0; // 0x0 225 226 private static final int MAP_RW = 1; // 0x1 227 228 private static final int TRANSFER_SIZE = 8192; // 0x2000 229 230 private static final long allocationGranularity; 231 232 static { 233 allocationGranularity = 0; 234 } 235 236 private final boolean append; 237 238 { 239 append = false; 240 } 241 242 public final java.io.FileDescriptor fd; 243 244 { 245 fd = null; 246 } 247 248 private volatile sun.nio.ch.FileLockTable fileLockTable; 249 250 private static volatile boolean fileSupported = true; 251 252 private final dalvik.system.CloseGuard guard; 253 254 { 255 guard = null; 256 } 257 258 private static boolean isSharedFileLockTable; 259 260 private final sun.nio.ch.FileDispatcher nd; 261 262 { 263 nd = null; 264 } 265 266 private final java.lang.Object parent; 267 268 { 269 parent = null; 270 } 271 272 private final java.lang.String path; 273 274 { 275 path = null; 276 } 277 278 private static volatile boolean pipeSupported = true; 279 280 private final java.lang.Object positionLock; 281 282 { 283 positionLock = null; 284 } 285 286 private static volatile boolean propertyChecked; 287 288 private final boolean readable; 289 290 { 291 readable = false; 292 } 293 294 private final sun.nio.ch.NativeThreadSet threads; 295 296 { 297 threads = null; 298 } 299 300 private static volatile boolean transferSupported = true; 301 302 private final boolean writable; 303 304 { 305 writable = false; 306 } 307 308 @SuppressWarnings({"unchecked", "deprecation", "all"}) 309 private static class SimpleFileLockTable extends sun.nio.ch.FileLockTable { 310 SimpleFileLockTable()311 public SimpleFileLockTable() { 312 throw new RuntimeException("Stub!"); 313 } 314 checkList(long position, long size)315 private void checkList(long position, long size) 316 throws java.nio.channels.OverlappingFileLockException { 317 throw new RuntimeException("Stub!"); 318 } 319 add(java.nio.channels.FileLock fl)320 public void add(java.nio.channels.FileLock fl) 321 throws java.nio.channels.OverlappingFileLockException { 322 throw new RuntimeException("Stub!"); 323 } 324 remove(java.nio.channels.FileLock fl)325 public void remove(java.nio.channels.FileLock fl) { 326 throw new RuntimeException("Stub!"); 327 } 328 removeAll()329 public java.util.List<java.nio.channels.FileLock> removeAll() { 330 throw new RuntimeException("Stub!"); 331 } 332 replace(java.nio.channels.FileLock fl1, java.nio.channels.FileLock fl2)333 public void replace(java.nio.channels.FileLock fl1, java.nio.channels.FileLock fl2) { 334 throw new RuntimeException("Stub!"); 335 } 336 337 private final java.util.List<java.nio.channels.FileLock> lockList; 338 339 { 340 lockList = null; 341 } 342 } 343 344 @SuppressWarnings({"unchecked", "deprecation", "all"}) 345 private static class Unmapper implements java.lang.Runnable { 346 Unmapper(long address, long size, int cap, java.io.FileDescriptor fd)347 private Unmapper(long address, long size, int cap, java.io.FileDescriptor fd) { 348 throw new RuntimeException("Stub!"); 349 } 350 run()351 public void run() { 352 throw new RuntimeException("Stub!"); 353 } 354 355 private volatile long address; 356 357 private final int cap; 358 359 { 360 cap = 0; 361 } 362 363 static volatile int count; 364 365 private final java.io.FileDescriptor fd; 366 367 { 368 fd = null; 369 } 370 371 private static final sun.nio.ch.NativeDispatcher nd; 372 373 static { 374 nd = null; 375 } 376 377 private final long size; 378 379 { 380 size = 0; 381 } 382 383 static volatile long totalCapacity; 384 385 static volatile long totalSize; 386 } 387 } 388