Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Ask a master who knows JAVA to tell me how to solve the problem of exceeding the length of string 65535.
Ask a master who knows JAVA to tell me how to solve the problem of exceeding the length of string 65535.
ByteArrayOutputStream baos = new ByteArrayOutputStream();

DataOutputStream byteOut = new dataoutputstream (baos);

byte[] data = stringArray.get(i)。 getBytes(“UTF-8”); -Here's the key.

ByteOut.write (data);

byte out . close();

byte[]input = baos . tobytearray();

You can convert a string into a byte array. Generally, an input stream cannot exceed 64k, and you can also split it into four 16k for processing!

The above code can solve your problem, remember to use it.