src.org.python.modules.jffi.NullMemory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jython-standalone Show documentation
Show all versions of jython-standalone Show documentation
Jython is an implementation of the high-level, dynamic, object-oriented
language Python written in 100% Pure Java, and seamlessly integrated with
the Java platform. It thus allows you to run Python on any Java platform.
package org.python.modules.jffi;
/**
* An implementation of MemoryIO that throws an exception on any access.
*/
public class NullMemory extends InvalidMemory implements DirectMemory {
static final NullMemory INSTANCE = new NullMemory();
public NullMemory() {
super("NULL pointer access");
}
public long getAddress() {
return 0L;
}
public boolean isNull() {
return true;
}
public final boolean isDirect() {
return true;
}
@Override
public boolean equals(Object obj) {
return obj instanceof DirectMemory && ((DirectMemory) obj).getAddress() == 0;
}
@Override
public int hashCode() {
return 0;
}
}