Skip to content

Commit 5f4e9a1

Browse files
committed
hop list is now accessible when iterating message from a channel.
1 parent 33deac2 commit 5f4e9a1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/net/sharksystem/asap/utils/ASAPSerialization.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,12 @@ public static byte[] asapHop2ByteArray(ASAPHop asapHop) throws IOException {
276276
return baos.toByteArray();
277277
}
278278

279+
public static byte[] asapHopList2ByteArray(List<ASAPHop> asapHops) throws IOException {
280+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
281+
writeASAPHopList(asapHops, baos);
282+
return baos.toByteArray();
283+
}
284+
279285
public static ASAPHop readASAPHop(InputStream is) throws IOException, ASAPException {
280286
CharSequence sender = ASAPSerialization.readCharSequenceParameter(is);
281287
boolean verified = ASAPSerialization.readBooleanParameter(is);
@@ -290,6 +296,11 @@ public static ASAPHop byteArray2ASAPHop(byte[] bytes) throws IOException, ASAPEx
290296
return readASAPHop(bais);
291297
}
292298

299+
public static List<ASAPHop> byteArray2ASAPHopList(byte[] bytes) throws IOException, ASAPException {
300+
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
301+
return readASAPHopList(bais);
302+
}
303+
293304
public static void writeASAPHopList(List<ASAPHop> asapHopList, OutputStream os) throws IOException {
294305
if(asapHopList == null || asapHopList.isEmpty()) {
295306
// no hops

0 commit comments

Comments
 (0)