⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 metadata.java.svn-base

📁 一些公用的Java函数
💻 SVN-BASE
字号:
/* * Metadata.java *  * Created on 2007-11-4, 20:48:54 *  * To change this template, choose Tools | Templates * and open the template in the editor. */package com.s7turn.sdk.content;import java.io.BufferedInputStream;import java.io.ByteArrayOutputStream;import java.io.IOException;import java.io.InputStream;import java.util.logging.Level;import java.util.logging.Logger;/** * * @author Long */public class Metadata{    public final short STORAGE_EXTERNAL = 1;    public final short STORAGE_DATABASE = 2;    private long metadataId;     private String path;    private String name;    private short storageType;    private String md5;     private String metaType; //is jpeg, doc, pdf, etc    private InputStream contentStream;    private byte[] content;            protected void processStream()    {        if( (content == null || content.length == 0) && contentStream != null )        {                        InputStream bufferInputStream = new BufferedInputStream( contentStream );            ByteArrayOutputStream baos = new ByteArrayOutputStream();            byte[] buffer = new byte[10240];            int bufReaded = 0;            try            {                do{                    bufReaded = bufferInputStream.read(buffer, 0, 10240);                    if( bufReaded > 0 )                        baos.write(buffer, 0, bufReaded);                }while( bufReaded > 0 );            }            catch (IOException ex)            {                Logger.getLogger(Metadata.class.getName()).log(Level.SEVERE, null, ex);            }            finally{                try                {                    baos.close();                }                catch (IOException ex)                {                                    }            }                        content = baos.toByteArray();                    }    }    public byte[] getContent()    {        processStream();        return content;    }    public void setContent(byte[] content)    {        this.content = content;    }        public String getMetaType()    {        return metaType;    }    public void setMetaType(String metaType)    {        this.metaType = metaType;    }        public String getMd5()    {        return md5;    }    public void setMd5(String md5)    {        this.md5 = md5;    }            public String getName()    {        return name;    }    public void setName(String name)    {        this.name = name;    }    public InputStream getContentStream()    {        return contentStream;    }    public void setContentStream( InputStream content )    {        this.contentStream = content;    }    public long getMetadataId()    {        return metadataId;    }    public void setMetadataId(long metadataId)    {        this.metadataId = metadataId;    }    public String getPath()    {        return path;    }    public void setPath(String path)    {        this.path = path;    }    public short getStorageType()    {        return storageType;    }    public void setStorageType(short storageType)    {        this.storageType = storageType;    }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -