Codota Logo
Os.close
Code IndexAdd Codota to your IDE (free)

How to use
close
method
in
libcore.io.Os

Best Java code snippets using libcore.io.Os.close (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: robovm/robovm

public void close(FileDescriptor fd) throws ErrnoException { os.close(fd); }
public void connect(FileDescriptor fd, InetAddress address, int port) throws ErrnoException, SocketException { os.connect(fd, address, port); }
origin: robovm/robovm

/**
 * Do not use. This is for System.loadLibrary use only.
 *
 * Checks whether {@code path} can be opened read-only. Similar to File.exists, but doesn't
 * require read permission on the parent, so it'll work in more cases, and allow you to
 * remove read permission from more directories. Everyone else should just open(2) and then
 * use the fd, but the loadLibrary API is broken by its need to ask ClassLoaders where to
 * find a .so rather than just calling dlopen(3).
 */
public static boolean canOpenReadOnly(String path) {
  try {
    // Use open(2) rather than stat(2) so we require fewer permissions. http://b/6485312.
    FileDescriptor fd = Libcore.os.open(path, O_RDONLY, 0);
    Libcore.os.close(fd);
    return true;
  } catch (ErrnoException errnoException) {
    return false;
  }
}
origin: robovm/robovm

/**
 * Calls close(2) on 'fd'. Also resets the internal int to -1. Does nothing if 'fd' is null
 * or invalid.
 */
public static void close(FileDescriptor fd) throws IOException {
  try {
    if (fd != null && fd.valid()) {
      Libcore.os.close(fd);
    }
  } catch (ErrnoException errnoException) {
    throw errnoException.rethrowAsIOException();
  }
}
origin: robovm/robovm

/**
 * Use this to mmap the whole file read-only.
 */
public static MemoryMappedFile mmapRO(String path) throws ErrnoException {
  FileDescriptor fd = Libcore.os.open(path, O_RDONLY, 0);
  long size = Libcore.os.fstat(fd).st_size;
  long address = Libcore.os.mmap(0L, size, PROT_READ, MAP_SHARED, fd, 0);
  Libcore.os.close(fd);
  return new MemoryMappedFile(address, size);
}
origin: robovm/robovm

public static void closeSocket(FileDescriptor fd) throws IOException {
  if (!fd.valid()) {
    // Socket.close doesn't throw if you try to close an already-closed socket.
    return;
  }
  int intFd = fd.getInt$();
  fd.setInt$(-1);
  FileDescriptor oldFd = new FileDescriptor();
  oldFd.setInt$(intFd);
  AsynchronousCloseMonitor.signalBlockedThreads(oldFd);
  try {
    Libcore.os.close(oldFd);
  } catch (ErrnoException errnoException) {
    // TODO: are there any cases in which we should throw?
  }
}
origin: robovm/robovm

@Override public void close(FileDescriptor fd) throws ErrnoException {
  try {
    if (S_ISSOCK(Libcore.os.fstat(fd).st_mode)) {
      if (isLingerSocket(fd)) {
        // If the fd is a socket with SO_LINGER set, we might block indefinitely.
        // We allow non-linger sockets so that apps can close their network
        // connections in methods like onDestroy which will run on the UI thread.
        BlockGuard.getThreadPolicy().onNetwork();
      }
      untagSocket(fd);
    }
  } catch (ErrnoException ignored) {
    // We're called via Socket.close (which doesn't ask for us to be called), so we
    // must not throw here, because Socket.close must not throw if asked to close an
    // already-closed socket. Also, the passed-in FileDescriptor isn't necessarily
    // a socket at all.
  }
  os.close(fd);
}
origin: MobiVM/robovm

public void close(FileDescriptor fd) throws ErrnoException { os.close(fd); }
public void connect(FileDescriptor fd, InetAddress address, int port) throws ErrnoException, SocketException { os.connect(fd, address, port); }
origin: ibinti/bugvm

public void close(FileDescriptor fd) throws ErrnoException { os.close(fd); }
public void connect(FileDescriptor fd, InetAddress address, int port) throws ErrnoException, SocketException { os.connect(fd, address, port); }
origin: MobiVM/robovm

/**
 * Calls close(2) on 'fd'. Also resets the internal int to -1. Does nothing if 'fd' is null
 * or invalid.
 */
public static void close(FileDescriptor fd) throws IOException {
  try {
    if (fd != null && fd.valid()) {
      Libcore.os.close(fd);
    }
  } catch (ErrnoException errnoException) {
    throw errnoException.rethrowAsIOException();
  }
}
origin: com.gluonhq/robovm-rt

/**
 * Calls close(2) on 'fd'. Also resets the internal int to -1. Does nothing if 'fd' is null
 * or invalid.
 */
public static void close(FileDescriptor fd) throws IOException {
  try {
    if (fd != null && fd.valid()) {
      Libcore.os.close(fd);
    }
  } catch (ErrnoException errnoException) {
    throw errnoException.rethrowAsIOException();
  }
}
origin: ibinti/bugvm

/**
 * Calls close(2) on 'fd'. Also resets the internal int to -1. Does nothing if 'fd' is null
 * or invalid.
 */
public static void close(FileDescriptor fd) throws IOException {
  try {
    if (fd != null && fd.valid()) {
      Libcore.os.close(fd);
    }
  } catch (ErrnoException errnoException) {
    throw errnoException.rethrowAsIOException();
  }
}
origin: com.mobidevelop.robovm/robovm-rt

/**
 * Calls close(2) on 'fd'. Also resets the internal int to -1. Does nothing if 'fd' is null
 * or invalid.
 */
public static void close(FileDescriptor fd) throws IOException {
  try {
    if (fd != null && fd.valid()) {
      Libcore.os.close(fd);
    }
  } catch (ErrnoException errnoException) {
    throw errnoException.rethrowAsIOException();
  }
}
origin: com.bugvm/bugvm-rt

/**
 * Calls close(2) on 'fd'. Also resets the internal int to -1. Does nothing if 'fd' is null
 * or invalid.
 */
public static void close(FileDescriptor fd) throws IOException {
  try {
    if (fd != null && fd.valid()) {
      Libcore.os.close(fd);
    }
  } catch (ErrnoException errnoException) {
    throw errnoException.rethrowAsIOException();
  }
}
origin: FlexoVM/flexovm

/**
 * Calls close(2) on 'fd'. Also resets the internal int to -1. Does nothing if 'fd' is null
 * or invalid.
 */
public static void close(FileDescriptor fd) throws IOException {
  try {
    if (fd != null && fd.valid()) {
      Libcore.os.close(fd);
    }
  } catch (ErrnoException errnoException) {
    throw errnoException.rethrowAsIOException();
  }
}
origin: MobiVM/robovm

/**
 * Use this to mmap the whole file read-only.
 */
public static MemoryMappedFile mmapRO(String path) throws ErrnoException {
  FileDescriptor fd = Libcore.os.open(path, O_RDONLY, 0);
  long size = Libcore.os.fstat(fd).st_size;
  long address = Libcore.os.mmap(0L, size, PROT_READ, MAP_SHARED, fd, 0);
  Libcore.os.close(fd);
  return new MemoryMappedFile(address, size);
}
origin: ibinti/bugvm

/**
 * Use this to mmap the whole file read-only.
 */
public static MemoryMappedFile mmapRO(String path) throws ErrnoException {
  FileDescriptor fd = Libcore.os.open(path, O_RDONLY, 0);
  long size = Libcore.os.fstat(fd).st_size;
  long address = Libcore.os.mmap(0L, size, PROT_READ, MAP_SHARED, fd, 0);
  Libcore.os.close(fd);
  return new MemoryMappedFile(address, size);
}
origin: FlexoVM/flexovm

/**
 * Use this to mmap the whole file read-only.
 */
public static MemoryMappedFile mmapRO(String path) throws ErrnoException {
  FileDescriptor fd = Libcore.os.open(path, O_RDONLY, 0);
  long size = Libcore.os.fstat(fd).st_size;
  long address = Libcore.os.mmap(0L, size, PROT_READ, MAP_SHARED, fd, 0);
  Libcore.os.close(fd);
  return new MemoryMappedFile(address, size);
}
origin: com.bugvm/bugvm-rt

/**
 * Use this to mmap the whole file read-only.
 */
public static MemoryMappedFile mmapRO(String path) throws ErrnoException {
  FileDescriptor fd = Libcore.os.open(path, O_RDONLY, 0);
  long size = Libcore.os.fstat(fd).st_size;
  long address = Libcore.os.mmap(0L, size, PROT_READ, MAP_SHARED, fd, 0);
  Libcore.os.close(fd);
  return new MemoryMappedFile(address, size);
}
origin: com.mobidevelop.robovm/robovm-rt

/**
 * Use this to mmap the whole file read-only.
 */
public static MemoryMappedFile mmapRO(String path) throws ErrnoException {
  FileDescriptor fd = Libcore.os.open(path, O_RDONLY, 0);
  long size = Libcore.os.fstat(fd).st_size;
  long address = Libcore.os.mmap(0L, size, PROT_READ, MAP_SHARED, fd, 0);
  Libcore.os.close(fd);
  return new MemoryMappedFile(address, size);
}
origin: com.gluonhq/robovm-rt

/**
 * Use this to mmap the whole file read-only.
 */
public static MemoryMappedFile mmapRO(String path) throws ErrnoException {
  FileDescriptor fd = Libcore.os.open(path, O_RDONLY, 0);
  long size = Libcore.os.fstat(fd).st_size;
  long address = Libcore.os.mmap(0L, size, PROT_READ, MAP_SHARED, fd, 0);
  Libcore.os.close(fd);
  return new MemoryMappedFile(address, size);
}
libcore.ioOsclose

Popular methods of Os

  • accept
  • access
  • bind
  • chmod
  • chown
  • connect
  • dup
  • dup2
  • environ
  • execv
  • execve
  • fchmod
  • execve,
  • fchmod,
  • fchown,
  • fcntlFlock,
  • fcntlLong,
  • fcntlVoid,
  • fdatasync,
  • fstat,
  • fstatvfs

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setScale (BigDecimal)
  • setContentView (Activity)
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • TimerTask (java.util)
    A task that can be scheduled for one-time or repeated execution by a Timer.
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now