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 java.lang.ObjectASharedMemoryfake that uses a private temporary disk file for storage and Java'sMappedByteBufferfor the memory mappings.
-
-
Constructor Summary
Constructors Constructor Description ShadowSharedMemory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.nio.ByteBuffermap(int prot, int offset, int length)Only works onSharedMemoryinstances fromSharedMemory.create(java.lang.String, int).protected static java.io.FileDescriptornCreate(java.lang.String name, int size)protected static intnGetSize(java.io.FileDescriptor fd)static voidreset()static voidsetCreateShouldThrow(android.system.ErrnoException e)Causes subsequent calls to {@link SharedMemory#create)} to throw the specified exception, if non-null.protected static voidunmap(java.nio.ByteBuffer mappedBuf)
-
-
-
Method Detail
-
reset
@Resetter public static void reset()
-
map
@Implementation protected java.nio.ByteBuffer map(int prot, int offset, int length) throws android.system.ErrnoExceptionOnly works onSharedMemoryinstances fromSharedMemory.create(java.lang.String, int)."prot" is ignored -- all mappings are read/write.
- Throws:
android.system.ErrnoException
-
unmap
@Implementation protected static void unmap(java.nio.ByteBuffer mappedBuf) throws android.system.ErrnoException- Throws:
android.system.ErrnoException
-
nCreate
@Implementation protected static java.io.FileDescriptor nCreate(java.lang.String name, int size) throws android.system.ErrnoException- Throws:
android.system.ErrnoException
-
nGetSize
@Implementation protected static int nGetSize(java.io.FileDescriptor fd)
-
setCreateShouldThrow
public static void setCreateShouldThrow(android.system.ErrnoException e)
Causes subsequent calls to {@link SharedMemory#create)} to throw the specified exception, if non-null. Pass null to restore create to normal operation.
-
-