Skip navigation links
org.noear.solon.core.handle

Class UploadedFile

    • Constructor Detail

      • UploadedFile

        public UploadedFile()
        上传文件
      • UploadedFile

        public UploadedFile(String contentType,
                            InputStream content,
                            String name)
        上传文件
        Parameters:
        contentType - 内容类型
        content - 内容流
        name - 文件名
      • UploadedFile

        public UploadedFile(String contentType,
                            long contentSize,
                            InputStream content,
                            String name,
                            String extension)
        基于上传输入的构建函数
        Parameters:
        contentType - 内容类型
        contentSize - 内容大小
        content - 内容流
        name - 文件名
        extension - 文件后缀名
      • UploadedFile

        public UploadedFile(Closeable deleteAction,
                            String contentType,
                            long contentSize,
                            InputStream content,
                            String name,
                            String extension)
        上传文件
        Parameters:
        contentType - 内容类型
        contentSize - 内容大小
        content - 内容流
        name - 文件名
        extension - 文件后缀名
    • Method Detail

      • getExtension

        public String getExtension()
        扩展名(例:jpg)
      • getContent

        public InputStream getContent()
        内容流
      • getContentAsBytes

        public byte[] getContentAsBytes()
                                 throws IOException
        内容字节形式
        Throws:
        IOException
        Since:
        2.8
      • getContentSize

        public long getContentSize()
        内容大小
      • transferTo

        public void transferTo(File file)
                        throws IOException
        将内容流迁移到目标文件
        Parameters:
        file - 目标文件
        Throws:
        IOException
      • transferTo

        public void transferTo(OutputStream stream)
                        throws IOException
        将内容流迁移到目标输出流
        Parameters:
        stream - 目标输出流
        Throws:
        IOException

Copyright © 2025. All rights reserved.