BinaryWriter implements AutoCloseable { public void writeInt64(long v) throws IOException { buffer.putLong(0, v); writer.write(array, 0, 8); } BinaryWriter(OutputStream stream); @Override void close(); void flush(); void write(byte[] buffer); void write(byte[] buffer, int index, int length); void writeBoolean(boolean v); void writeByte(byte v); void writeDouble(double v); void writeECPoint(ECPoint v); void writeFixedString(String v, int length); void writeFloat(float v); void writeInt32(int v); void writeInt64(long v); void writeUInt32(long v); void writeSerializableVariableBytes(NeoSerializable v); void writeSerializableVariable(List<? extends NeoSerializable> v); void writeSerializableVariableBytes(List<? extends NeoSerializable> v); void writeSerializableFixed(NeoSerializable v); void writeSerializableFixed(List<? extends NeoSerializable> v); void writeUInt16(int v); void writeVarBytes(byte[] v); void writeVarInt(long v);  }
@Test public void writeInt64() throws IOException { long l = Long.MAX_VALUE; writer.writeInt64(l); assertAndResetStreamContents(new byte[]{(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x7f}); l = Long.MIN_VALUE; writer.writeInt64(l); assertAndResetStreamContents(new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80}); l = 0L; writer.writeInt64(l); assertAndResetStreamContents(new byte[]{(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00}); l = 1234567890L; writer.writeInt64(l); assertAndResetStreamContents(new byte[]{(byte) 0xd2, (byte) 0x02, (byte) 0x96, (byte) 0x49, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00}); }