@Test(expected = InvalidParameterException.class) public void testNonAsciiMessage() { JSONObject message = new JSONObject(); message.put("no ascii", "ä"); iamWriter.write(new IAMIndex(0), message); }
public String write(IAMIndex index, JSONObject message) throws IotaAPICallFailedException { if(!TryteTool.isAsciiString(message.toString())) throw new InvalidParameterException("parameter message contains non-ascii characters"); String signature = generateIAMPacketSignature(index, message); JSONObject iamPacket = buildIAMPacket(signature, message); return publishIAMPacketInFragments(iamPacket.toString(), buildAddress(index)); }
IAMWriter extends IAMStream { public String write(IAMIndex index, JSONObject message) throws IotaAPICallFailedException { if(!TryteTool.isAsciiString(message.toString())) throw new InvalidParameterException("parameter message contains non-ascii characters"); String signature = generateIAMPacketSignature(index, message); JSONObject iamPacket = buildIAMPacket(signature, message); return publishIAMPacketInFragments(iamPacket.toString(), buildAddress(index)); } }
IAMWriter extends IAMStream { public String write(IAMIndex index, JSONObject message) throws IotaAPICallFailedException { if(!TryteTool.isAsciiString(message.toString())) throw new InvalidParameterException("parameter message contains non-ascii characters"); String signature = generateIAMPacketSignature(index, message); JSONObject iamPacket = buildIAMPacket(signature, message); return publishIAMPacketInFragments(iamPacket.toString(), buildAddress(index)); } IAMWriter();  IAMWriter(String id, String privateKeyTrytes); }
IAMWriter extends IAMStream { public String write(IAMIndex index, JSONObject message) throws IotaAPICallFailedException { if(!TryteTool.isAsciiString(message.toString())) throw new InvalidParameterException("parameter message contains non-ascii characters"); String signature = generateIAMPacketSignature(index, message); JSONObject iamPacket = buildIAMPacket(signature, message); return publishIAMPacketInFragments(iamPacket.toString(), buildAddress(index)); } IAMWriter();  IAMWriter(String id, String privateKeyTrytes); String write(IAMIndex index, JSONObject message); String getID(); String getPrivateKeyTrytes(); }
IAMWriter extends IAMStream { public String write(IAMIndex index, JSONObject message) throws IotaAPICallFailedException { if(!TryteTool.isAsciiString(message.toString())) throw new InvalidParameterException("parameter message contains non-ascii characters"); String signature = generateIAMPacketSignature(index, message); JSONObject iamPacket = buildIAMPacket(signature, message); return publishIAMPacketInFragments(iamPacket.toString(), buildAddress(index)); } IAMWriter();  IAMWriter(String id, String privateKeyTrytes); String write(IAMIndex index, JSONObject message); String getID(); String getPrivateKeyTrytes();  }