public Slice newSlice ( long address , int size , Object reference ) { if ( address <= 0 ) { throw new IllegalArgumentException ( "Invalid address: " + address ) ; } if ( reference == null ) { throw new NullPointerException ( "Object reference is null" ) ; } if ( size == 0 ) { return Slices . EMPTY_SLICE ; } return new Slice ( null , address , size , size , reference ) ; }
Creates a slice for directly a raw memory address . This is inherently unsafe as it may be used to access arbitrary memory . The slice will hold the specified object reference to prevent the garbage collector from freeing it while it is in use by the slice .