File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
src/main/java/net/sharksystem/utils Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 11package net .sharksystem .utils ;
22
3+ import net .sharksystem .asap .ASAPException ;
4+ import net .sharksystem .asap .utils .ASAPSerialization ;
5+
36import java .io .*;
47import java .util .*;
58
@@ -48,14 +51,15 @@ public static byte[] long2byteArray(long value) {
4851 return result ;
4952 }
5053
51- public static byte [] characterSequence2bytes (CharSequence cs ) {
52- // TODO - that's ok?
53- return cs .toString ().getBytes ();
54+ public static byte [] characterSequence2bytes (CharSequence cs ) throws IOException {
55+ ByteArrayOutputStream baos = new ByteArrayOutputStream ();
56+ ASAPSerialization .writeCharSequenceParameter (cs , baos );
57+ return baos .toByteArray ();
5458 }
5559
56- public static CharSequence bytes2characterSequence (byte [] bytes ) {
57- // TODO - that's ok?
58- return new String ( bytes );
60+ public static CharSequence bytes2characterSequence (byte [] bytes ) throws IOException , ASAPException {
61+ ByteArrayInputStream bais = new ByteArrayInputStream ( bytes );
62+ return ASAPSerialization . readCharSequenceParameter ( bais );
5963 }
6064
6165 public static List <CharSequence > string2CharSequenceList (String s ) {
You can’t perform that action at this time.
0 commit comments