Package org.robolectric.shadows
Class ShadowSharedMemory
java.lang.Object
org.robolectric.shadows.ShadowSharedMemory
@Implements(value=android.os.SharedMemory.class, minSdk=27, isInAndroidSdk=false) public class ShadowSharedMemory extends Object
A
SharedMemory fake that uses a private temporary disk file for storage and Java's MappedByteBuffer for the memory mappings.-
Constructor Summary
Constructors Constructor Description ShadowSharedMemory() -
Method Summary
Modifier and Type Method Description protected ByteBuffermap(int prot, int offset, int length)Only works onSharedMemoryinstances fromSharedMemory.create(java.lang.String, int).protected static FileDescriptornCreate(String name, int size)protected static intnGetSize(FileDescriptor fd)static voidreset()static voidsetCreateShouldThrow(ErrnoException e)Causes subsequent calls to {@link SharedMemory#create)} to throw the specified exception, if non-null.protected static voidunmap(ByteBuffer mappedBuf)
-
Constructor Details
-
ShadowSharedMemory
public ShadowSharedMemory()
-
-
Method Details
-
reset
-
map
Only works onSharedMemoryinstances fromSharedMemory.create(java.lang.String, int)."prot" is ignored -- all mappings are read/write.
- Throws:
ErrnoException
-
unmap
- Throws:
ErrnoException
-
nCreate
@Implementation protected static FileDescriptor nCreate(String name, int size) throws ErrnoException- Throws:
ErrnoException
-
nGetSize
-
setCreateShouldThrow
Causes subsequent calls to {@link SharedMemory#create)} to throw the specified exception, if non-null. Pass null to restore create to normal operation.
-