8262403: Enhanced data transfers

Reviewed-by: rhalade, prr, vdyakov, ahgross
This commit is contained in:
Sergey Bylokhov 2021-03-21 05:01:33 +00:00 committed by Henry Jen
parent ef9315bead
commit 9accf7c894

View File

@ -25,6 +25,7 @@
package java.awt.datatransfer;
import java.io.ByteArrayOutputStream;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
@ -321,9 +322,12 @@ MimeTypeParameterList(rawdata.substring(semIndex));
ClassNotFoundException {
String s = in.readUTF();
if (s == null || s.length() == 0) { // long mime type
byte[] ba = new byte[in.readInt()];
in.readFully(ba);
s = new String(ba);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = in.readInt();
while (len-- > 0) {
baos.write(in.readByte());
}
s = baos.toString();
}
try {
parse(s);