/** * Use JikesRVM's internal read function - the fast way. * * @param fd File descriptor * @param dst Destination buffer * @param position Starting offset in the buffer * @param len Number of bytes to read * @return Number of bytes read, or -1 for end of file. * @throws IOException */ private static int read(int fd, byte[] dst, int position, int len) throws IOException { if (VM.VerifyAssertions) VM._assert(MemoryManager.willNeverMove(dst)); int bytes = FileSystem.readBytes(fd, dst, position, len); if (bytes < 0) { throw new IOException("Error code " + Integer.toString(bytes)); } if (bytes == 0) { bytes = -1; } return bytes; }