public void write(final int b) throws IOException { writeByte(b); }
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); } }
@Override public void write(final byte[] b, final int off, final int len) throws IOException { if (off < 0 || len < 0 || off+len > b.length) { throw new IndexOutOfBoundsException(); } try { memory.putBytes(currentAddress, b, off, len); currentAddress+=len; } catch (IndexOutOfBoundsException e) { toClose.add(buffer); buffer = new MMapBuffer(file, 0, memory.length() * 2, FileChannel.MapMode.READ_WRITE, byteOrder); memory = buffer.memory(); write(b, off, len); } }
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 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); } }
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); } }