Tabnine Logo
Os.fstat
Code IndexAdd Tabnine to your IDE (free)

How to use
fstat
method
in
libcore.io.Os

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

origin: robovm/robovm

public StructStat fstat(FileDescriptor fd) throws ErrnoException { return os.fstat(fd); }
public StructStatVfs fstatvfs(FileDescriptor fd) throws ErrnoException { return os.fstatvfs(fd); }
origin: robovm/robovm

/**
 * Returns the length of this file in bytes.
 *
 * @return the file's length in bytes.
 * @throws IOException
 *             if this file is closed or some other I/O error occurs.
 */
public long length() throws IOException {
  try {
    return Libcore.os.fstat(fd).st_size;
  } catch (ErrnoException errnoException) {
    throw errnoException.rethrowAsIOException();
  }
}
origin: robovm/robovm

public long size() throws IOException {
  checkOpen();
  try {
    return Libcore.os.fstat(fd).st_size;
  } 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 FileReader(String absolutePath) throws IOException {
  // We use IoBridge.open because callers might differentiate
  // between a FileNotFoundException and a general IOException.
  //
  // NOTE: This costs us an additional call to fstat(2) to test whether
  // "absolutePath" is a directory or not. We can eliminate it
  // at the cost of copying some code from IoBridge.open.
  try {
    fd = IoBridge.open(absolutePath, O_RDONLY);
  } catch (FileNotFoundException fnfe) {
    throw fnfe;
  }
  int capacity;
  try {
    final StructStat stat = Libcore.os.fstat(fd);
    // Like RAF & other APIs, we assume that the file size fits
    // into a 32 bit integer.
    capacity = (int) stat.st_size;
    if (capacity == 0) {
      unknownLength = true;
      capacity = 8192;
    }
  } catch (ErrnoException exception) {
    closeQuietly(fd);
    throw exception.rethrowAsIOException();
  }
  bytes = new byte[capacity];
}
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: robovm/robovm

if (S_ISDIR(Libcore.os.fstat(fd).st_mode)) {
  throw new ErrnoException("open", EISDIR);
origin: robovm/robovm

if (S_ISREG(Libcore.os.fstat(fd).st_mode) || ftruncateException.errno != EINVAL) {
  throw ftruncateException.rethrowAsIOException();
origin: ibinti/bugvm

public long size() throws IOException {
  checkOpen();
  try {
    return Libcore.os.fstat(fd).st_size;
  } catch (ErrnoException errnoException) {
    throw errnoException.rethrowAsIOException();
  }
}
origin: MobiVM/robovm

public long size() throws IOException {
  checkOpen();
  try {
    return Libcore.os.fstat(fd).st_size;
  } catch (ErrnoException errnoException) {
    throw errnoException.rethrowAsIOException();
  }
}
origin: com.gluonhq/robovm-rt

public long size() throws IOException {
  checkOpen();
  try {
    return Libcore.os.fstat(fd).st_size;
  } catch (ErrnoException errnoException) {
    throw errnoException.rethrowAsIOException();
  }
}
origin: FlexoVM/flexovm

public long size() throws IOException {
  checkOpen();
  try {
    return Libcore.os.fstat(fd).st_size;
  } catch (ErrnoException errnoException) {
    throw errnoException.rethrowAsIOException();
  }
}
origin: com.mobidevelop.robovm/robovm-rt

public long size() throws IOException {
  checkOpen();
  try {
    return Libcore.os.fstat(fd).st_size;
  } catch (ErrnoException errnoException) {
    throw errnoException.rethrowAsIOException();
  }
}
origin: com.bugvm/bugvm-rt

public long size() throws IOException {
  checkOpen();
  try {
    return Libcore.os.fstat(fd).st_size;
  } 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: 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: 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: 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: 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);
}
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);
}
libcore.ioOsfstat

Popular methods of Os

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

Popular in Java

  • Parsing JSON documents to java classes using gson
  • putExtra (Intent)
  • getExternalFilesDir (Context)
  • getContentResolver (Context)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now