Upload files through webService and files through webService
1. The client switches the stream to a string and transmits it through webService.
2. The server converts the string to a stream and saves it to the local device. Note:
Objects transmitted in webservice must implement the serialization interface involving programs: Convert objects to strings:
1. Convert the input stream to the output stream InputStream in = input stream;
Byte [] buffer = new byte [1024];
OutStream out = new bytew.ryinputsteam ();
Int len = 0;
While (len = in. read (buffer ))! =-1 ){
Out. write (buffer );
}
In. close ();
2, Base64.encode (new Strng (out. toByteArray (), "ios-8859-1 "));
Converts a string to a bitstream.
1, byte [] temp = Base64.decode (String );
New ByteArrayInputStream (temp );
This is probably the case, not carefully written!
Java enterprise-level general permission security framework source code SpringMVC mybatis or hibernate + ehcache shiro druid bootstrap HTML5
[Download java framework source code]