Upload files through webService and files through webService

Source: Internet
Author: User

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]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.