public long length() { return memory.length(); } }
public long length() { return memory.length(); } }
public DoubleArray(Memory buffer, long address, long length) { if (address < 0) throw new IndexOutOfBoundsException("address must be >= 0"); if (length < 0) throw new IllegalArgumentException("length must be >= 0"); if (address+length*TYPE_SIZE > buffer.length()) throw new IndexOutOfBoundsException(String.format("address+length*%d must be <= buffer.length()", TYPE_SIZE)); this.buffer = buffer.slice(address, length*TYPE_SIZE); this.length = length; }
public CharArray(Memory buffer, long address, long length) { if (address < 0) throw new IndexOutOfBoundsException("address must be >= 0"); if (length < 0) throw new IllegalArgumentException("length must be >= 0"); if (address+length*TYPE_SIZE > buffer.length()) throw new IndexOutOfBoundsException(String.format("address+length*%d must be <= buffer.length()", TYPE_SIZE)); this.buffer = buffer.slice(address, length*TYPE_SIZE); this.length = length; }
public IntArray(Memory buffer, long address, long length) { if (address < 0) throw new IndexOutOfBoundsException("address must be >= 0"); if (length < 0) throw new IllegalArgumentException("length must be >= 0"); if (address+length*TYPE_SIZE > buffer.length()) throw new IndexOutOfBoundsException(String.format("address+length*%d must be <= buffer.length()", TYPE_SIZE)); this.buffer = buffer.slice(address, length*TYPE_SIZE); this.length = length; }
public LongArray(Memory buffer, long address, long length) { if (address < 0) throw new IndexOutOfBoundsException("address must be >= 0"); if (length < 0) throw new IllegalArgumentException("length must be >= 0"); if (address+length*TYPE_SIZE > buffer.length()) throw new IndexOutOfBoundsException(String.format("address+length*%d must be <= buffer.length()", TYPE_SIZE)); this.buffer = buffer.slice(address, length*TYPE_SIZE); this.length = length; }
public FloatArray(Memory buffer, long address, long length) { if (address < 0) throw new IndexOutOfBoundsException("address must be >= 0"); if (length < 0) throw new IllegalArgumentException("length must be >= 0"); if (address+length*TYPE_SIZE > buffer.length()) throw new IndexOutOfBoundsException(String.format("address+length*%d must be <= buffer.length()", TYPE_SIZE)); this.buffer = buffer.slice(address, length*TYPE_SIZE); this.length = length; }
public ShortArray(Memory buffer, long address, long length) { if (address < 0) throw new IndexOutOfBoundsException("address must be >= 0"); if (length < 0) throw new IllegalArgumentException("length must be >= 0"); if (address+length*TYPE_SIZE > buffer.length()) throw new IndexOutOfBoundsException(String.format("address+length*%d must be <= buffer.length()", TYPE_SIZE)); this.buffer = buffer.slice(address, length*TYPE_SIZE); this.length = length; }
public ByteArray(Memory buffer, long address, long length) { if (address < 0) throw new IndexOutOfBoundsException("address must be >= 0"); if (length < 0) throw new IllegalArgumentException("length must be >= 0"); if (address+length > buffer.length()) throw new IndexOutOfBoundsException("address+length must be <= buffer.length()"); this.buffer = buffer.slice(address, length); this.length = length; }
@Override public void putBytes(long l, Memory source) { putBytes(l, source, 0, source.length()); }
@Override public void getBytes(long l, Memory dest) { getBytes(l, dest, 0, dest.length()); }
public void writeBoolean(final boolean v) throws IOException { try { memory.putByte(currentAddress, (byte)(v ? 1 : 0)); currentAddress++; } catch (IndexOutOfBoundsException e) { toClose.add(buffer); buffer = new MMapBuffer(file, 0, memory.length() * 2, FileChannel.MapMode.READ_WRITE, byteOrder); memory = buffer.memory(); writeBoolean(v); } }
public void writeFloat(final float v) throws IOException { try { memory.putFloat(currentAddress, v); currentAddress+=4; } catch (IndexOutOfBoundsException e) { toClose.add(buffer); buffer = new MMapBuffer(file, 0, memory.length() * 2, FileChannel.MapMode.READ_WRITE, byteOrder); memory = buffer.memory(); writeFloat(v); } }
public void writeChar(final int v) throws IOException { try { memory.putChar(currentAddress, (char)v); currentAddress+=2; } catch (IndexOutOfBoundsException e) { toClose.add(buffer); buffer = new MMapBuffer(file, 0, memory.length() * 2, FileChannel.MapMode.READ_WRITE, byteOrder); memory = buffer.memory(); writeChar(v); } }
public void writeLong(final long v) throws IOException { try { memory.putLong(currentAddress, v); currentAddress+=8; } catch (IndexOutOfBoundsException e) { toClose.add(buffer); buffer = new MMapBuffer(file, 0, memory.length() * 2, FileChannel.MapMode.READ_WRITE, byteOrder); memory = buffer.memory(); writeLong(v); } }
public void writeDouble(final double v) throws IOException { try { memory.putDouble(currentAddress, v); currentAddress+=8; } catch (IndexOutOfBoundsException e) { toClose.add(buffer); buffer = new MMapBuffer(file, 0, memory.length() * 2, FileChannel.MapMode.READ_WRITE, byteOrder); memory = buffer.memory(); writeDouble(v); } }
public void writeByte(final int v) throws IOException { try { memory.putByte(currentAddress, (byte)v); currentAddress++; } catch (IndexOutOfBoundsException e) { toClose.add(buffer); buffer = new MMapBuffer(file, 0, memory.length() * 2, FileChannel.MapMode.READ_WRITE, byteOrder); memory = buffer.memory(); writeByte(v); } }
public void writeShort(final int v) throws IOException { try { memory.putShort(currentAddress, (short)v); currentAddress+=2; } catch (IndexOutOfBoundsException e) { toClose.add(buffer); buffer = new MMapBuffer(file, 0, memory.length() * 2, FileChannel.MapMode.READ_WRITE, byteOrder); memory = buffer.memory(); writeShort(v); } }
public void writeInt(final int v) throws IOException { try { memory.putInt(currentAddress, v); currentAddress+=4; } catch (IndexOutOfBoundsException e) { toClose.add(buffer); buffer = new MMapBuffer(file, 0, memory.length() * 2, FileChannel.MapMode.READ_WRITE, byteOrder); memory = buffer.memory(); writeInt(v); } }