All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jclarion.clarion.memory.CMem Maven / Gradle / Ivy

There is a newer version: 1.86
Show newest version
package org.jclarion.clarion.memory;

import org.jclarion.clarion.runtime.CMemory;

public abstract class CMem implements Cloneable
{
	public abstract CMem clone();
	
	public static CMem create()
	{
		return new CharBufferCMem();
	}

	public static CMem create(int size)
	{
		return new CharBufferCMem(size);
	}
	
	public static byte[] toByteArray(CMem in)
	{
		byte[] result = new byte[in.remaining()];
		for (int scan=0;scan=remain;
	}
	
	public void writeInt(int aInt)
	{
		writeByte(aInt);
		writeByte(aInt>>8);
		writeByte(aInt>>16);
		writeByte(aInt>>24);
	}
	
	public void writeString(CharSequence seq)
	{
		for (int scan=0;scan0 ) {
			a.append(readChar());
			maxLength--;
		}
	}
	
	public Object readObject()
	{
		return CMemory.resolveAddress(readInt()); 
	}

	public final void reset()
	{
		resetRead();
		resetWrite();
	}

	public static void fromByteArray(CMem sos, byte[] sA) {
		for (byte b : sA) {
			sos.writeByte(b);
		}
	}

	public void writeBytes(byte[] buffer, int ofs, int len) 
	{
		len=len+ofs;
		while (ofs




© 2015 - 2025 Weber Informatics LLC | Privacy Policy