protected void writeShort(long offset, short value) throws IOException { byte[] b = new byte[2]; b[0] = (byte) ((value >>> 8) & 0xFF); b[1] = (byte) ((value >>> 0) & 0xFF); write(offset, b); }
final void writeBytes(byte[] b) throws IOException { assert b.length == byteCount : "Invalid number of bytes supplied to RrdPrimitive.write method"; backend.write(pointer, b); }
final void writeBytes(byte[] b) throws IOException { assert b.length == byteCount : "Invalid number of bytes supplied to RrdPrimitive.write method"; backend.write(pointer, b); }
protected void writeString(long offset, String value, int length) throws IOException { ByteBuffer bbuf = ByteBuffer.allocate(length * 2); bbuf.order(BYTEORDER); bbuf.position(0); bbuf.limit(length * 2); CharBuffer cbuf = bbuf.asCharBuffer(); cbuf.put(value); while (cbuf.position() < cbuf.limit()) { cbuf.put(' '); } write(offset, bbuf.array()); }
final void writeString(long offset, String value) throws IOException { value = value.trim(); byte[] b = new byte[RrdPrimitive.STRING_LENGTH * 2]; for (int i = 0, k = 0; i < RrdPrimitive.STRING_LENGTH; i++) { char c = (i < value.length()) ? value.charAt(i) : ' '; byte[] cb = getCharBytes(c); b[k++] = cb[0]; b[k++] = cb[1]; } write(offset, b); }
final void writeDouble(long offset, double value, int count) throws IOException { byte[] b = getDoubleBytes(value); byte[] image = new byte[8 * count]; for (int i = 0, k = 0; i < count; i++) { image[k++] = b[0]; image[k++] = b[1]; image[k++] = b[2]; image[k++] = b[3]; image[k++] = b[4]; image[k++] = b[5]; image[k++] = b[6]; image[k++] = b[7]; } write(offset, image); image = null; }
final void writeDouble(long offset, double value) throws IOException { write(offset, getDoubleBytes(value)); }
protected void writeInt(long offset, int value) throws IOException { write(offset, getIntBytes(value)); }
protected void writeLong(long offset, long value) throws IOException { write(offset, getLongBytes(value)); }
protected void writeDouble(long offset, double value) throws IOException { write(offset, getDoubleBytes(value)); }
final void writeLong(long offset, long value) throws IOException { write(offset, getLongBytes(value)); }
final void writeInt(long offset, int value) throws IOException { write(offset, getIntBytes(value)); }
protected void writeDouble(long offset, double[] values) throws IOException { int count = values.length; byte[] image = new byte[8 * count]; int k = 0; for (int i = 0; i < count; i++) { byte[] b = getDoubleBytes(values[i]); image[k++] = b[0]; image[k++] = b[1]; image[k++] = b[2]; image[k++] = b[3]; image[k++] = b[4]; image[k++] = b[5]; image[k++] = b[6]; image[k++] = b[7]; } write(offset, image); }
protected void writeDouble(long offset, double value, int count) throws IOException { byte[] b = getDoubleBytes(value); byte[] image = new byte[8 * count]; int k = 0; for (int i = 0; i < count; i++) { image[k++] = b[0]; image[k++] = b[1]; image[k++] = b[2]; image[k++] = b[3]; image[k++] = b[4]; image[k++] = b[5]; image[k++] = b[6]; image[k++] = b[7]; } write(offset, image); }
final void writeDouble(long offset, double[] values) throws IOException { int count = values.length; byte[] image = new byte[8 * count]; for (int i = 0, k = 0; i < count; i++) { byte[] b = getDoubleBytes(values[i]); image[k++] = b[0]; image[k++] = b[1]; image[k++] = b[2]; image[k++] = b[3]; image[k++] = b[4]; image[k++] = b[5]; image[k++] = b[6]; image[k++] = b[7]; } write(offset, image); image = null; }