@Implementation
  protected ByteBuffer map(int prot, int offset, int length) throws ErrnoException {
    ReflectionHelpers.callInstanceMethod(realObject, "checkOpen");
    File file = filesByFd.get(getRealFileDescriptor());
    if (file == null) {
      throw new IllegalStateException("SharedMemory from a parcel isn't yet implemented!");
    }

    try (RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw")) {
      // It would be easy to support a MapMode.READ_ONLY type mapping as well except none of the
      // OsConstants fields are even initialized by robolectric and so "prot" is always zero!
      return randomAccessFile.getChannel().map(MapMode.READ_WRITE, offset, length);
    } catch (IOException e) {
      throw new ErrnoException(e.getMessage(), OsConstants.EIO, e);
    }
  }
@Implementation
  protected ByteBuffer map(int prot, int offset, int length) throws ErrnoException {
    ReflectionHelpers.callInstanceMethod(realObject, "checkOpen");
    File file = filesByFd.get(getRealFileDescriptor());
    if (file == null) {
      throw new IllegalStateException("SharedMemory from a parcel isn't yet implemented!");
    }

    try (RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw")) {
      
      
      return randomAccessFile.getChannel().map(MapMode.READ_WRITE, offset, length);
    } catch (IOException e) {
      throw new ErrnoException(e.getMessage(), OsConstants.EIO, e);
    }
  }
@ Implementation protected ByteBuffer map ( int prot , int offset , int length ) throws ErrnoException { ReflectionHelpers . callInstanceMethod ( realObject , "checkOpen" ) ; File file = filesByFd . get ( getRealFileDescriptor ( ) ) ; if ( file == null ) { throw new IllegalStateException ( "SharedMemory from a parcel isn't yet implemented!" ) ; } try ( RandomAccessFile randomAccessFile = new RandomAccessFile ( file , "rw" ) ) { // It would be easy to support a MapMode.READ_ONLY type mapping as well except none of the // OsConstants fields are even initialized by robolectric and so "prot" is always zero! return randomAccessFile . getChannel ( ) . map ( MapMode . READ_WRITE , offset , length ) ; } catch ( IOException e ) { throw new ErrnoException ( e . getMessage ( ) , OsConstants . EIO , e ) ; } }
Only works on {@link SharedMemory} instances from {@link SharedMemory#create}.

<p>"prot" is ignored -- all mappings are read/write.
Only works on { @link SharedMemory } instances from { @link SharedMemory#create } .