memoryresource.java
来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 524 行
JAVA
524 行
/**
* $Id: MemoryResource.java,v 1.1 2003/11/25 11:42:18 epr Exp $
*/
package org.jnode.system;
import org.jnode.vm.Address;
/**
* Block of memory resource.
*
* @author Ewout Prangsma (epr@users.sourceforge.net)
*/
public interface MemoryResource extends Resource {
/**
* Gets a 8-bit signed byte at the given memory address
* @param memPtr
* @return byte
*/
public abstract byte getByte(int memPtr);
/**
* Gets multiple 8-bit signed bytes from the given memory address
* @param memPtr
* @param dst
* @param dstOfs
* @param length
*/
public abstract void getBytes(int memPtr, byte[] dst, int dstOfs, int length);
/**
* Gets a 16-bit signed short at the given memory address
* @param memPtr
* @return short
*/
public abstract short getShort(int memPtr);
/**
* Gets multiple 16-bit signed bytes from the given memory address
* @param memPtr
* @param dst
* @param dstOfs
* @param length
*/
public abstract void getShorts(int memPtr, short[] dst, int dstOfs, int length);
/**
* Gets a 16-bit unsigned char at the given memory address
* @param memPtr
* @return char
*/
public abstract char getChar(int memPtr);
/**
* Gets multiple 16-bit unsigned chars from the given memory address
* @param memPtr
* @param dst
* @param dstOfs
* @param length
*/
public abstract void getChars(int memPtr, char[] dst, int dstOfs, int length);
/**
* Gets a 32-bit signed int at the given memory address
* @param memPtr
* @return int
*/
public abstract int getInt(int memPtr);
/**
* Gets multiple 32-bit signed ints from the given memory address
* @param memPtr
* @param dst
* @param dstOfs
* @param length
*/
public abstract void getInts(int memPtr, char[] dst, int dstOfs, int length);
/**
* Gets a 64-bit signed long at the given memory address
* @param memPtr
* @return long
*/
public abstract long getLong(int memPtr);
/**
* Gets multiple 64-bit signed longs from the given memory address
* @param memPtr
* @param dst
* @param dstOfs
* @param length
*/
public abstract void getLongs(int memPtr, long[] dst, int dstOfs, int length);
/**
* Gets a float at the given memory address
* @param memPtr
* @return float
*/
public abstract float getFloat(int memPtr);
/**
* Gets multiple 32-bit floats from the given memory address
* @param memPtr
* @param dst
* @param dstOfs
* @param length
*/
public abstract void getChars(int memPtr, float[] dst, int dstOfs, int length);
/**
* Gets a double at the given memory address
* @param memPtr
* @return double
*/
public abstract double getDouble(int memPtr);
/**
* Gets multiple 64-bit doubles from the given memory address
* @param memPtr
* @param dst
* @param dstOfs
* @param length
*/
public abstract void getDoubles(int memPtr, double[] dst, int dstOfs, int length);
/**
* Gets a object reference at the given memory address
* @param memPtr
* @return Object
*/
public abstract Object getObject(int memPtr);
/**
* Sets a byte at a given memory address
* @param memPtr
* @param value
*/
public abstract void setByte(int memPtr, byte value);
/**
* Sets a byte at a given memory address
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void setByte(int memPtr, byte value, int count);
/**
* Perform a bitwise AND of the byte at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void andByte(int memPtr, byte value, int count);
/**
* Perform a bitwise OR of the byte at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void orByte(int memPtr, byte value, int count);
/**
* Perform a bitwise XOR of the byte at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void xorByte(int memPtr, byte value, int count);
/**
* Sets multiple 8-bit signed bytes at the given memory address
* @param src
* @param srcOfs
* @param dstPtr
* @param length
*/
public abstract void setBytes(byte[] src, int srcOfs, int dstPtr, int length);
/**
* Sets a char at a given memory address
* @param memPtr
* @param value
*/
public abstract void setChar(int memPtr, char value);
/**
* Sets a char at a given memory address
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void setChar(int memPtr, char value, int count);
/**
* Perform a bitwise AND of the char at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void andChar(int memPtr, char value, int count);
/**
* Perform a bitwise OR of the char at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void orChar(int memPtr, char value, int count);
/**
* Perform a bitwise XOR of the char at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void xorChar(int memPtr, char value, int count);
/**
* Sets multiple 16-bit unsigned chars at the given memory address
* @param src
* @param srcOfs
* @param dstPtr
* @param length
*/
public abstract void setChars(char[] src, int srcOfs, int dstPtr, int length);
/**
* Sets a short at a given memory address
* @param memPtr
* @param value
*/
public abstract void setShort(int memPtr, short value);
/**
* Sets a short at a given memory address
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void setShort(int memPtr, short value, int count);
/**
* Perform a bitwise AND of the short at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void andShort(int memPtr, short value, int count);
/**
* Perform a bitwise OR of the short at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void orShort(int memPtr, short value, int count);
/**
* Perform a bitwise XOR of the short at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void xorShort(int memPtr, short value, int count);
/**
* Sets multiple 16-bit signed shorts at the given memory address
* @param src
* @param srcOfs
* @param dstPtr
* @param length
*/
public abstract void setShorts(short[] src, int srcOfs, int dstPtr, int length);
/**
* Sets an int at a given memory address
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void setInt24(int memPtr, int value, int count);
/**
* Perform a bitwise AND of the int at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void andInt24(int memPtr, int value, int count);
/**
* Perform a bitwise OR of the int at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void orInt24(int memPtr, int value, int count);
/**
* Perform a bitwise XOR of the int at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void xorInt24(int memPtr, int value, int count);
/**
* Sets an int at a given memory address
* @param memPtr
* @param value
*/
public abstract void setInt(int memPtr, int value);
/**
* Sets an int at a given memory address
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void setInt(int memPtr, int value, int count);
/**
* Perform a bitwise AND of the int at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void andInt(int memPtr, int value, int count);
/**
* Perform a bitwise OR of the int at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void orInt(int memPtr, int value, int count);
/**
* Perform a bitwise XOR of the int at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void xorInt(int memPtr, int value, int count);
/**
* Sets multiple 32-bit signed ints at the given memory address
* @param src
* @param srcOfs
* @param dstPtr
* @param length
*/
public abstract void setInts(int[] src, int srcOfs, int dstPtr, int length);
/**
* Sets a float at a given memory address
* @param memPtr
* @param value
*/
public abstract void setFloat(int memPtr, float value);
/**
* Sets a float at a given memory address
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void setFloat(int memPtr, float value, int count);
/**
* Sets multiple 32-bit floats at the given memory address
* @param src
* @param srcOfs
* @param dstPtr
* @param length
*/
public abstract void setFloats(float[] src, int srcOfs, int dstPtr, int length);
/**
* Sets a long at a given memory address
* @param memPtr
* @param value
*/
public abstract void setLong(int memPtr, long value);
/**
* Sets a long at a given memory address
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void setLong(int memPtr, long value, int count);
/**
* Perform a bitwise AND of the long at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void andLong(int memPtr, long value, int count);
/**
* Perform a bitwise OR of the long at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void orLong(int memPtr, long value, int count);
/**
* Perform a bitwise XOR of the long at the given address and the given value.
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void xorLong(int memPtr, long value, int count);
/**
* Sets multiple 64-bit signed longs at the given memory address
* @param src
* @param srcOfs
* @param dstPtr
* @param length
*/
public abstract void setLongs(long[] src, int srcOfs, int dstPtr, int length);
/**
* Sets a double at a given memory address
* @param memPtr
* @param value
*/
public abstract void setDouble(int memPtr, double value);
/**
* Sets a double at a given memory address
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void setDouble(int memPtr, double value, int count);
/**
* Sets multiple 64-bit doubles at the given memory address
* @param src
* @param srcOfs
* @param dstPtr
* @param length
*/
public abstract void setDoubles(double[] src, int srcOfs, int dstPtr, int length);
/**
* Sets a Object at a given memory address
* @param memPtr
* @param value
*/
public abstract void setObject(int memPtr, Object value);
/**
* Sets a Object at a given memory address
* While count is greater then 1, the address is incremented and the process repeats.
* @param memPtr
* @param value
* @param count
*/
public abstract void setObject(int memPtr, Object value, int count);
/**
* Fill the memory at the given memory address with size times 0 bytes.
*
* memPtr must be VmObject.SLOT_SIZE aligned
*
* size % VmObject.SLOT_SIZE must be 0
* @param memPtr
* @param size
*/
public abstract void clear(int memPtr, int size);
public abstract void copy(int srcMemPtr, int destMemPtr, int size);
/**
* Returns the size of this buffer in bytes.
* @return int
*/
public abstract long getSize();
/**
* Gets the address of the first byte of this buffer
* @return The address of the first byte of this buffer
*/
public abstract Address getAddress();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?