Help needed for strings....urgent
We as a part of our project are dealing with something called info reference which is actually a stream of bytes which has hex values in it. Values can range form 00 to FF. Now the API to which this has to be sent expects a String. We tried putting the information in a string and sending it but the system at site rejects the info reference in two cases:
1. When the info reference is of form: 11 23 45 00 00 56 56 (This is print of content of each byte of the string in Hex format. If we print is it as a string then we will see control chars printed)
The first 00 is taken to be as a NULL and the reading of the string stops there itself and hence the system rejects is as Invalid format error.
2. When the info stream has form : 11 23 89 89 80 80
Here UTF coding error is coming since the string is made up of chars and for Hex values more that 7F there is no valid char represention. So the 89 and 80 and any Hex value more than 7F is replaced by the REPLACEMENT CHARACTER e.g. EFBFBD.
We want to pass the info reference as it is. Is there any way in which java strings can be tweaked to take care of the above mentioned situaton? Its strings only.....byte arrays wont be accepted.
Please do reply.
Sorry again if this is not related to the forum but I really need a solution to this.
Anticipating early reply