congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
IoBridge.open
Code IndexAdd Tabnine to your IDE (free)

How to use
open
method
in
libcore.io.IoBridge

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

origin: robovm/robovm

/**
 * Constructs a new {@code FileInputStream} that reads from {@code file}.
 *
 * @param file
 *            the file from which this stream reads.
 * @throws FileNotFoundException
 *             if {@code file} does not exist.
 */
public FileInputStream(File file) throws FileNotFoundException {
  if (file == null) {
    throw new NullPointerException("file == null");
  }
  this.fd = IoBridge.open(file.getAbsolutePath(), O_RDONLY);
  this.shouldClose = true;
  guard.open("close");
}
origin: robovm/robovm

/**
 * Constructs a new {@code FileOutputStream} that writes to {@code file}.
 * If {@code append} is true and the file already exists, it will be appended to; otherwise
 * it will be truncated. The file will be created if it does not exist.
 *
 * @throws FileNotFoundException if the file cannot be opened for writing.
 */
public FileOutputStream(File file, boolean append) throws FileNotFoundException {
  if (file == null) {
    throw new NullPointerException("file == null");
  }
  this.mode = O_WRONLY | O_CREAT | (append ? O_APPEND : O_TRUNC);
  this.fd = IoBridge.open(file.getAbsolutePath(), mode);
  this.shouldClose = true;
  this.guard.open("close");
}
origin: robovm/robovm

this.fd = IoBridge.open(file.getAbsolutePath(), flags);
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: MobiVM/robovm

/**
 * Constructs a new {@code FileOutputStream} that writes to {@code file}.
 * If {@code append} is true and the file already exists, it will be appended to; otherwise
 * it will be truncated. The file will be created if it does not exist.
 *
 * @throws FileNotFoundException if the file cannot be opened for writing.
 */
public FileOutputStream(File file, boolean append) throws FileNotFoundException {
  if (file == null) {
    throw new NullPointerException("file == null");
  }
  this.mode = O_WRONLY | O_CREAT | (append ? O_APPEND : O_TRUNC);
  this.fd = IoBridge.open(file.getAbsolutePath(), mode);
  this.shouldClose = true;
  this.guard.open("close");
}
origin: ibinti/bugvm

/**
 * Constructs a new {@code FileInputStream} that reads from {@code file}.
 *
 * @param file
 *            the file from which this stream reads.
 * @throws FileNotFoundException
 *             if {@code file} does not exist.
 */
public FileInputStream(File file) throws FileNotFoundException {
  if (file == null) {
    throw new NullPointerException("file == null");
  }
  this.fd = IoBridge.open(file.getAbsolutePath(), O_RDONLY);
  this.shouldClose = true;
  guard.open("close");
}
origin: ibinti/bugvm

/**
 * Constructs a new {@code FileOutputStream} that writes to {@code file}.
 * If {@code append} is true and the file already exists, it will be appended to; otherwise
 * it will be truncated. The file will be created if it does not exist.
 *
 * @throws FileNotFoundException if the file cannot be opened for writing.
 */
public FileOutputStream(File file, boolean append) throws FileNotFoundException {
  if (file == null) {
    throw new NullPointerException("file == null");
  }
  this.mode = O_WRONLY | O_CREAT | (append ? O_APPEND : O_TRUNC);
  this.fd = IoBridge.open(file.getAbsolutePath(), mode);
  this.shouldClose = true;
  this.guard.open("close");
}
origin: com.bugvm/bugvm-rt

/**
 * Constructs a new {@code FileInputStream} that reads from {@code file}.
 *
 * @param file
 *            the file from which this stream reads.
 * @throws FileNotFoundException
 *             if {@code file} does not exist.
 */
public FileInputStream(File file) throws FileNotFoundException {
  if (file == null) {
    throw new NullPointerException("file == null");
  }
  this.fd = IoBridge.open(file.getAbsolutePath(), O_RDONLY);
  this.shouldClose = true;
  guard.open("close");
}
origin: com.gluonhq/robovm-rt

/**
 * Constructs a new {@code FileInputStream} that reads from {@code file}.
 *
 * @param file
 *            the file from which this stream reads.
 * @throws FileNotFoundException
 *             if {@code file} does not exist.
 */
public FileInputStream(File file) throws FileNotFoundException {
  if (file == null) {
    throw new NullPointerException("file == null");
  }
  this.fd = IoBridge.open(file.getAbsolutePath(), O_RDONLY);
  this.shouldClose = true;
  guard.open("close");
}
origin: com.gluonhq/robovm-rt

/**
 * Constructs a new {@code FileOutputStream} that writes to {@code file}.
 * If {@code append} is true and the file already exists, it will be appended to; otherwise
 * it will be truncated. The file will be created if it does not exist.
 *
 * @throws FileNotFoundException if the file cannot be opened for writing.
 */
public FileOutputStream(File file, boolean append) throws FileNotFoundException {
  if (file == null) {
    throw new NullPointerException("file == null");
  }
  this.mode = O_WRONLY | O_CREAT | (append ? O_APPEND : O_TRUNC);
  this.fd = IoBridge.open(file.getAbsolutePath(), mode);
  this.shouldClose = true;
  this.guard.open("close");
}
origin: MobiVM/robovm

/**
 * Constructs a new {@code FileInputStream} that reads from {@code file}.
 *
 * @param file
 *            the file from which this stream reads.
 * @throws FileNotFoundException
 *             if {@code file} does not exist.
 */
public FileInputStream(File file) throws FileNotFoundException {
  if (file == null) {
    throw new NullPointerException("file == null");
  }
  this.fd = IoBridge.open(file.getAbsolutePath(), O_RDONLY);
  this.shouldClose = true;
  guard.open("close");
}
origin: com.bugvm/bugvm-rt

/**
 * Constructs a new {@code FileOutputStream} that writes to {@code file}.
 * If {@code append} is true and the file already exists, it will be appended to; otherwise
 * it will be truncated. The file will be created if it does not exist.
 *
 * @throws FileNotFoundException if the file cannot be opened for writing.
 */
public FileOutputStream(File file, boolean append) throws FileNotFoundException {
  if (file == null) {
    throw new NullPointerException("file == null");
  }
  this.mode = O_WRONLY | O_CREAT | (append ? O_APPEND : O_TRUNC);
  this.fd = IoBridge.open(file.getAbsolutePath(), mode);
  this.shouldClose = true;
  this.guard.open("close");
}
origin: com.mobidevelop.robovm/robovm-rt

/**
 * Constructs a new {@code FileOutputStream} that writes to {@code file}.
 * If {@code append} is true and the file already exists, it will be appended to; otherwise
 * it will be truncated. The file will be created if it does not exist.
 *
 * @throws FileNotFoundException if the file cannot be opened for writing.
 */
public FileOutputStream(File file, boolean append) throws FileNotFoundException {
  if (file == null) {
    throw new NullPointerException("file == null");
  }
  this.mode = O_WRONLY | O_CREAT | (append ? O_APPEND : O_TRUNC);
  this.fd = IoBridge.open(file.getAbsolutePath(), mode);
  this.shouldClose = true;
  this.guard.open("close");
}
origin: com.mobidevelop.robovm/robovm-rt

/**
 * Constructs a new {@code FileInputStream} that reads from {@code file}.
 *
 * @param file
 *            the file from which this stream reads.
 * @throws FileNotFoundException
 *             if {@code file} does not exist.
 */
public FileInputStream(File file) throws FileNotFoundException {
  if (file == null) {
    throw new NullPointerException("file == null");
  }
  this.fd = IoBridge.open(file.getAbsolutePath(), O_RDONLY);
  this.shouldClose = true;
  guard.open("close");
}
origin: FlexoVM/flexovm

/**
 * Constructs a new {@code FileInputStream} that reads from {@code file}.
 *
 * @param file
 *            the file from which this stream reads.
 * @throws FileNotFoundException
 *             if {@code file} does not exist.
 */
public FileInputStream(File file) throws FileNotFoundException {
  if (file == null) {
    throw new NullPointerException("file == null");
  }
  this.fd = IoBridge.open(file.getAbsolutePath(), O_RDONLY);
  this.shouldClose = true;
  guard.open("close");
}
origin: FlexoVM/flexovm

/**
 * Constructs a new {@code FileOutputStream} that writes to {@code file}.
 * If {@code append} is true and the file already exists, it will be appended to; otherwise
 * it will be truncated. The file will be created if it does not exist.
 *
 * @throws FileNotFoundException if the file cannot be opened for writing.
 */
public FileOutputStream(File file, boolean append) throws FileNotFoundException {
  if (file == null) {
    throw new NullPointerException("file == null");
  }
  this.mode = O_WRONLY | O_CREAT | (append ? O_APPEND : O_TRUNC);
  this.fd = IoBridge.open(file.getAbsolutePath(), mode);
  this.shouldClose = true;
  this.guard.open("close");
}
origin: com.mobidevelop.robovm/robovm-rt

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: MobiVM/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: com.bugvm/bugvm-rt

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: FlexoVM/flexovm

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];
}
libcore.ioIoBridgeopen

Javadoc

java.io only throws FileNotFoundException when opening files, regardless of what actually went wrong. Additionally, java.io is more restrictive than POSIX when it comes to opening directories: POSIX says read-only is okay, but java.io doesn't even allow that. We also have an Android-specific hack to alter the default permissions.

Popular methods of IoBridge

  • available
  • bind
  • booleanFromInt
  • booleanToInt
  • closeSocket
  • connect
    Connects socket 'fd' to 'inetAddress' on 'port', with a the given 'timeoutMs'. Use timeoutMs == 0 fo
  • connectDetail
  • connectErrno
  • getSocketLocalAddress
  • getSocketLocalPort
  • getSocketOption
    java.net has its own socket options similar to the underlying Unix ones. We paper over the differenc
  • getSocketOptionErrno
  • getSocketOption,
  • getSocketOptionErrno,
  • isConnected,
  • maybeThrowAfterRecvfrom,
  • maybeThrowAfterSendto,
  • postRecvfrom,
  • read,
  • recvfrom,
  • sendto

Popular in Java

  • Finding current android device location
  • getSharedPreferences (Context)
  • getResourceAsStream (ClassLoader)
  • getContentResolver (Context)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • ImageIO (javax.imageio)
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • JFileChooser (javax.swing)
  • PhpStorm for WordPress
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