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
ASharedMemory
fake that uses a private temporary disk file for storage and Java'sMappedByteBuffer
for 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 ByteBuffer
map(int prot, int offset, int length)
Only works onSharedMemory
instances fromSharedMemory.create(java.lang.String, int)
.protected static FileDescriptor
nCreate(String name, int size)
protected static int
nGetSize(FileDescriptor fd)
static void
reset()
static void
setCreateShouldThrow(ErrnoException e)
Causes subsequent calls to {@link SharedMemory#create)} to throw the specified exception, if non-null.protected static void
unmap(ByteBuffer mappedBuf)
-
-
-
Method Detail
-
reset
@Resetter public static void reset()
-
map
@Implementation protected ByteBuffer map(int prot, int offset, int length) throws ErrnoException
Only works onSharedMemory
instances fromSharedMemory.create(java.lang.String, int)
."prot" is ignored -- all mappings are read/write.
- Throws:
ErrnoException
-
unmap
@Implementation protected static void unmap(ByteBuffer mappedBuf) throws ErrnoException
- Throws:
ErrnoException
-
nCreate
@Implementation protected static FileDescriptor nCreate(String name, int size) throws ErrnoException
- Throws:
ErrnoException
-
nGetSize
@Implementation protected static int nGetSize(FileDescriptor fd)
-
setCreateShouldThrow
public static void setCreateShouldThrow(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.
-
-