// Path: src/main/java/org/cleverframe/fastdfs/utils/IOUtils.java
// public class IOUtils {
//     /**
//      * 日志
//      */
//     private static final Logger logger = LoggerFactory.getLogger(IOUtils.class);
// 
//     private static final int EOF = -1;
// 
//     private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
// 
//     public static void closeQuietly(final Closeable closeable) {
//         try {
//             if (closeable != null) {
//                 closeable.close();
//             }
//         } catch (final IOException ioe) {
//             logger.error("数据流关闭异常", ioe);
//         }
//     }
// 
//     public static void closeQuietly(final Closeable... closeables) {
//         if (closeables == null) {
//             return;
//         }
//         for (final Closeable closeable : closeables) {
//             closeQuietly(closeable);
//         }
//     }
// 
//     private static long copyLarge(final InputStream input, final OutputStream output, final byte[] buffer)
//             throws IOException {
//         long count = 0;
//         int n;
//         while (EOF != (n = input.read(buffer))) {
//             output.write(buffer, 0, n);
//             count += n;
//         }
//         return count;
//     }
// 
//     private static long copyLarge(final InputStream input, final OutputStream output)
//             throws IOException {
//         return copy(input, output, DEFAULT_BUFFER_SIZE);
//     }
// 
//     private static long copy(final InputStream input, final OutputStream output, final int bufferSize)
//             throws IOException {
//         return copyLarge(input, output, new byte[bufferSize]);
//     }
// 
//     public static int copy(final InputStream input, final OutputStream output) throws IOException {
//         final long count = copyLarge(input, output);
//         if (count > Integer.MAX_VALUE) {
//             return -1;
//         }
//         return (int) count;
//     }
// 
//     public static byte[] toByteArray(final InputStream input) throws IOException {
//         final ByteArrayOutputStream output = new ByteArrayOutputStream();
//         copy(input, output);
//         return output.toByteArray();
//     }
// }


import org.cleverframe.fastdfs.utils.IOUtils;
import java.io.IOException;
import java.io.InputStream;
package org.cleverframe.fastdfs.protocol.storage.callback;




/**
 * 直接返回Byte[]数据
 * 作者：LiZW <br/>
 * 创建时间：2016/11/20 15:56 <br/>
 */
public class DownloadByteArray implements DownloadCallback<byte[]> {
    @Override
    public byte[] receive(InputStream inputStream) throws IOException {
// Path: src/main/java/org/cleverframe/fastdfs/utils/IOUtils.java
// public class IOUtils {
//     /**
//      * 日志
//      */
//     private static final Logger logger = LoggerFactory.getLogger(IOUtils.class);
// 
//     private static final int EOF = -1;
// 
//     private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
// 
//     public static void closeQuietly(final Closeable closeable) {
//         try {
//             if (closeable != null) {
//                 closeable.close();
//             }
//         } catch (final IOException ioe) {
//             logger.error("数据流关闭异常", ioe);
//         }
//     }
// 
//     public static void closeQuietly(final Closeable... closeables) {
//         if (closeables == null) {
//             return;
//         }
//         for (final Closeable closeable : closeables) {
//             closeQuietly(closeable);
//         }
//     }
// 
//     private static long copyLarge(final InputStream input, final OutputStream output, final byte[] buffer)
//             throws IOException {
//         long count = 0;
//         int n;
//         while (EOF != (n = input.read(buffer))) {
//             output.write(buffer, 0, n);
//             count += n;
//         }
//         return count;
//     }
// 
//     private static long copyLarge(final InputStream input, final OutputStream output)
//             throws IOException {
//         return copy(input, output, DEFAULT_BUFFER_SIZE);
//     }
// 
//     private static long copy(final InputStream input, final OutputStream output, final int bufferSize)
//             throws IOException {
//         return copyLarge(input, output, new byte[bufferSize]);
//     }
// 
//     public static int copy(final InputStream input, final OutputStream output) throws IOException {
//         final long count = copyLarge(input, output);
//         if (count > Integer.MAX_VALUE) {
//             return -1;
//         }
//         return (int) count;
//     }
// 
//     public static byte[] toByteArray(final InputStream input) throws IOException {
//         final ByteArrayOutputStream output = new ByteArrayOutputStream();
//         copy(input, output);
//         return output.toByteArray();
//     }
// }


// Path: src/main/java/org/cleverframe/fastdfs/protocol/storage/callback/DownloadByteArray.java
import org.cleverframe.fastdfs.utils.IOUtils;
import java.io.IOException;
import java.io.InputStream;

package org.cleverframe.fastdfs.protocol.storage.callback;




/**
 * 直接返回Byte[]数据
 * 作者：LiZW <br/>
 * 创建时间：2016/11/20 15:56 <br/>
 */
public class DownloadByteArray implements DownloadCallback<byte[]> {
    @Override
    public byte[] receive(InputStream inputStream) throws IOException {
        return IOUtils.toByteArray(inputStream);