Example usage for org.aspectj.util FileUtil readAsByteArray

List of usage examples for org.aspectj.util FileUtil readAsByteArray

Introduction

In this page you can find the example usage for org.aspectj.util FileUtil readAsByteArray.

Prototype

public static byte[] readAsByteArray(InputStream inStream) throws IOException 

Source Link

Document

Reads this input stream and returns contents as a byte[]

Usage

From source file:com.qycloud.oatos.license.web.HomeController.java

@RequestMapping(value = "/api/lic/download/{licId}", method = RequestMethod.GET)
@ResponseBody/*  w  ww  . j  a va  2 s  .  co m*/
public ResponseEntity<byte[]> downloadLic(@PathVariable long licId,
        @RequestParam(value = "ut", required = true) String ut) {
    try {
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
        headers.setContentDispositionFormData("attachment", "oatos.lic");
        return new ResponseEntity<byte[]>(FileUtil.readAsByteArray(this.licService.downloadLic(licId)), headers,
                HttpStatus.CREATED);
    } catch (Exception ex) {
        ex.printStackTrace();
        return null;
    }
}