Tabnine Logo
ArrayUtils.checkOffsetAndCount
Code IndexAdd Tabnine to your IDE (free)

How to use
checkOffsetAndCount
method
in
com.lody.virtual.helper.utils.ArrayUtils

Best Java code snippets using com.lody.virtual.helper.utils.ArrayUtils.checkOffsetAndCount (Showing top 6 results out of 315)

origin: android-hacker/VirtualXposed

  /**
   * java.io always writes every byte it's asked to, or fails with an error. (That is, unlike
   * Unix it never just writes as many bytes as happens to be convenient.)
   */
  public static void write(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws IOException {
    ArrayUtils.checkOffsetAndCount(bytes.length, byteOffset, byteCount);
    if (byteCount == 0) {
      return;
    }
    try {
      while (byteCount > 0) {
        int bytesWritten = Os.write(fd, bytes, byteOffset, byteCount);
        byteCount -= bytesWritten;
        byteOffset += bytesWritten;
      }
    } catch (ErrnoException errnoException) {
      throw new IOException(errnoException);
    }
  }
}
origin: android-hacker/VirtualXposed

/**
 * java.io thinks that a read at EOF is an error and should return -1, contrary to traditional
 * Unix practice where you'd read until you got 0 bytes (and any future read would return -1).
 */
public static int read(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws IOException {
  ArrayUtils.checkOffsetAndCount(bytes.length, byteOffset, byteCount);
  if (byteCount == 0) {
    return 0;
  }
  try {
    int readCount = Os.read(fd, bytes, byteOffset, byteCount);
    if (readCount == 0) {
      return -1;
    }
    return readCount;
  } catch (ErrnoException errnoException) {
    if (errnoException.errno == OsConstants.EAGAIN) {
      // We return 0 rather than throw if we try to read from an empty non-blocking pipe.
      return 0;
    }
    throw new IOException(errnoException);
  }
}
origin: darkskygit/VirtualApp

  /**
   * java.io always writes every byte it's asked to, or fails with an error. (That is, unlike
   * Unix it never just writes as many bytes as happens to be convenient.)
   */
  public static void write(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws IOException {
    ArrayUtils.checkOffsetAndCount(bytes.length, byteOffset, byteCount);
    if (byteCount == 0) {
      return;
    }
    try {
      while (byteCount > 0) {
        int bytesWritten = Os.write(fd, bytes, byteOffset, byteCount);
        byteCount -= bytesWritten;
        byteOffset += bytesWritten;
      }
    } catch (ErrnoException errnoException) {
      throw new IOException(errnoException);
    }
  }
}
origin: bzsome/VirtualApp-x326

  /**
   * java.io always writes every byte it's asked to, or fails with an error. (That is, unlike
   * Unix it never just writes as many bytes as happens to be convenient.)
   */
  public static void write(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws IOException {
    ArrayUtils.checkOffsetAndCount(bytes.length, byteOffset, byteCount);
    if (byteCount == 0) {
      return;
    }
    try {
      while (byteCount > 0) {
        int bytesWritten = Os.write(fd, bytes, byteOffset, byteCount);
        byteCount -= bytesWritten;
        byteOffset += bytesWritten;
      }
    } catch (ErrnoException errnoException) {
      throw new IOException(errnoException);
    }
  }
}
origin: darkskygit/VirtualApp

/**
 * java.io thinks that a read at EOF is an error and should return -1, contrary to traditional
 * Unix practice where you'd read until you got 0 bytes (and any future read would return -1).
 */
public static int read(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws IOException {
  ArrayUtils.checkOffsetAndCount(bytes.length, byteOffset, byteCount);
  if (byteCount == 0) {
    return 0;
  }
  try {
    int readCount = Os.read(fd, bytes, byteOffset, byteCount);
    if (readCount == 0) {
      return -1;
    }
    return readCount;
  } catch (ErrnoException errnoException) {
    if (errnoException.errno == OsConstants.EAGAIN) {
      // We return 0 rather than throw if we try to read from an empty non-blocking pipe.
      return 0;
    }
    throw new IOException(errnoException);
  }
}
origin: bzsome/VirtualApp-x326

/**
 * java.io thinks that a read at EOF is an error and should return -1, contrary to traditional
 * Unix practice where you'd read until you got 0 bytes (and any future read would return -1).
 */
public static int read(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws IOException {
  ArrayUtils.checkOffsetAndCount(bytes.length, byteOffset, byteCount);
  if (byteCount == 0) {
    return 0;
  }
  try {
    int readCount = Os.read(fd, bytes, byteOffset, byteCount);
    if (readCount == 0) {
      return -1;
    }
    return readCount;
  } catch (ErrnoException errnoException) {
    if (errnoException.errno == OsConstants.EAGAIN) {
      // We return 0 rather than throw if we try to read from an empty non-blocking pipe.
      return 0;
    }
    throw new IOException(errnoException);
  }
}
com.lody.virtual.helper.utilsArrayUtilscheckOffsetAndCount

Popular methods of ArrayUtils

  • contains
  • getFirst
  • indexOf
    Return first index of value in array, or -1 if not found.
  • indexOfFirst
  • indexOfLast
  • indexOfObject
  • isEmpty
  • protoIndexOf

Popular in Java

  • Reactive rest calls using spring rest template
  • onRequestPermissionsResult (Fragment)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • putExtra (Intent)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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