I have a byte array of a JPEG photo created as below.
import java.sql.Blob;
byte[] blobAsBytes = null;
blobLength = (int) blob.length();
blobAsBytes = blob.getBytes(1, blobLength);
//Some operation to make the byte array size 20kb
return blobAsBytes;
I need to return this byte array to a service which accepts Oracle long raw type and it works fine.
As this needs to be transferred through network, byte array returned by method has to be less than 20kb.
How can I make the byte array small in size, and send without any data loss, so it can be restored as a photo?