// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: File.java
package com.jspsmart.upload;
import java.io.ByteArrayInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
// Referenced classes of package com.jspsmart.upload:
// SmartUploadException, SmartUpload
public class File
{
File()
{
m_startData = 0;
m_endData = 0;
m_size = 0;
m_fieldname = new String();
m_filename = new String();
m_fileExt = new String();
m_filePathName = new String();
m_contentType = new String();
m_contentDisp = new String();
m_typeMime = new String();
m_subTypeMime = new String();
m_contentString = new String();
m_isMissing = true;
}
public void saveAs(String destFilePathName)
throws SmartUploadException, IOException
{
saveAs(destFilePathName, 0);
}
public void saveAs(String destFilePathName, int optionSaveAs)
throws SmartUploadException, IOException
{
String path = new String();
path = m_parent.getPhysicalPath(destFilePathName, optionSaveAs);
if(path == null)
throw new IllegalArgumentException("There is no specified destination file (1140).");
try
{
java.io.File file = new java.io.File(path);
file.createNewFile();
try
{
FileOutputStream fileOut = new FileOutputStream(file);
fileOut.write(m_parent.m_binArray, m_startData, m_size);
fileOut.close();
}
catch(Exception e)
{
throw new IllegalArgumentException("Path's name is invalid or does not exist (1135).");
}
}
catch(IOException e)
{
throw new SmartUploadException("File can't be saved (1120).");
}
}
public void fileToField(ResultSet rs, String columnName)
throws SQLException, SmartUploadException, IOException, ServletException
{
long numBlocks = 0L;
int blockSize = 0x10000;
int leftOver = 0;
int pos = 0;
if(rs == null)
throw new IllegalArgumentException("The RecordSet cannot be null (1145).");
if(columnName == null)
throw new IllegalArgumentException("The columnName cannot be null (1150).");
if(columnName.length() == 0)
throw new IllegalArgumentException("The columnName cannot be empty (1155).");
numBlocks = BigInteger.valueOf(m_size).divide(BigInteger.valueOf(blockSize)).longValue();
leftOver = BigInteger.valueOf(m_size).mod(BigInteger.valueOf(blockSize)).intValue();
try
{
for(int i = 1; (long)i < numBlocks; i++)
{
rs.updateBinaryStream(columnName, new ByteArrayInputStream(m_parent.m_binArray, pos, blockSize), blockSize);
pos = pos != 0 ? pos : 1;
pos = i * blockSize;
}
if(leftOver > 0)
rs.updateBinaryStream(columnName, new ByteArrayInputStream(m_parent.m_binArray, pos, leftOver), leftOver);
}
catch(SQLException e)
{
byte binByte2[] = new byte[m_size];
System.arraycopy(m_parent.m_binArray, m_startData, binByte2, 0, m_size);
rs.updateBytes(columnName, binByte2);
}
catch(Exception e)
{
throw new SmartUploadException("Unable to save file in the DataBase (1130).");
}
}
public boolean isMissing()
{
return m_isMissing;
}
public String getFieldName()
{
return m_fieldname;
}
public String getFileName()
{
return m_filename;
}
public String getFilePathName()
{
return m_filePathName;
}
public String getFileExt()
{
return m_fileExt;
}
public String getContentType()
{
return m_contentType;
}
public String getContentDisp()
{
return m_contentDisp;
}
public String getContentString()
{
String strTMP = new String(m_parent.m_binArray, m_startData, m_size);
return strTMP;
}
public String getTypeMIME()
throws IOException
{
return m_typeMime;
}
public String getSubTypeMIME()
{
return m_subTypeMime;
}
public int getSize()
{
return m_size;
}
protected int getStartData()
{
return m_startData;
}
protected int getEndData()
{
return m_endData;
}
protected void setParent(SmartUpload parent)
{
m_parent = parent;
}
protected void setStartData(int startData)
{
m_startData = startData;
}
protected void setEndData(int endData)
{
m_endData = endData;
}
protected void setSize(int size)
{
m_size = size;
}
protected void setIsMissing(boolean isMissing)
{
m_isMissing = isMissing;
}
protected void setFieldName(String fieldName)
{
m_fieldname = fieldName;
}
protected void setFileName(String fileName)
{
m_filename = fileName;
}
protected void setFilePathName(String filePathName)
{
m_filePathName = filePathName;
}
protected void setFileExt(String fileExt)
{
m_fileExt = fileExt;
}
protected void setContentType(String contentType)
{
m_contentType = contentType;
}
protected void setContentDisp(String contentDisp)
{
m_contentDisp = contentDisp;
}
protected void setTypeMIME(String TypeMime)
{
m_typeMime = TypeMime;
}
protected void setSubTypeMIME(String subTypeMime)
{
m_subTypeMime = subTypeMime;
}
public byte getBinaryData(int index)
{
if(m_startData + index > m_endData)
throw new ArrayIndexOutOfBoundsException("Index Out of range (1115).");
if(m_startData + index <= m_endData)
return m_parent.m_binArray[m_startData + index];
else
return 0;
}
private SmartUpload m_parent;
private int m_startData;
private int m_endData;
private int m_size;
private String m_fieldname;
private String m_filename;
private String m_fileExt;
private String m_filePathName;
private String m_contentType;
private String m_contentDisp;
private String m_typeMime;
private String m_subTypeMime;
private String m_contentString;
private boolean m_isMissing;
public static final int SAVEAS_AUTO = 0;
public static final int SAVEAS_VIRTUAL = 1;
public static final int SAVEAS_PHYSICAL = 2;
}
没有合适的资源?快使用搜索试试~ 我知道了~
师生交互平台JSP开发
共218个文件
jsp:68个
html:65个
gif:26个
4星 · 超过85%的资源 需积分: 12 95 下载量 18 浏览量
2009-04-29
18:52:48
上传
评论
收藏 1.25MB RAR 举报
温馨提示
师生交互平台师生交互 平台师生交互平台
资源推荐
资源详情
资源评论
收起资源包目录
师生交互平台JSP开发 (218个子文件)
checkcode.bmp 1KB
SmartUpload.class 16KB
File.class 5KB
Files.class 2KB
Request.class 2KB
hello.class 782B
conn.class 741B
conn.class 741B
SmartUploadException.class 389B
southidc.css 904B
southidc.css 904B
southidc.css 904B
southidc.css 904B
css.css 787B
Thumbs.db 57KB
Thumbs.db 53KB
Thumbs.db 45KB
Thumbs.db 32KB
Thumbs.db 10KB
Thumbs.db 7KB
Thumbs.db 6KB
Thumbs.db 5KB
jad.exe 32KB
login_l.gif 8KB
login_r.gif 7KB
bf.gif 5KB
c.gif 4KB
d.gif 4KB
title.gif 4KB
title.gif 4KB
title.gif 4KB
b.gif 3KB
a.gif 3KB
f.gif 2KB
aaa.gif 2KB
e.gif 2KB
title_bg_quit.gif 2KB
title_bg_quit.gif 2KB
title_bg_quit.gif 2KB
menudown.gif 2KB
menudown.gif 2KB
menudown.gif 2KB
QQ.gif 2KB
homepage.gif 1KB
edit.gif 904B
homepdage.gif 893B
email.gif 671B
hu.gif 623B
table.gif 149B
LeftTree.htm 10KB
LeftTree.htm 6KB
LeftTree.htm 6KB
sysadmin_view.htm 5KB
admin.htm 2KB
default.htm 969B
upload.htm 252B
update.html 9KB
forget.html 6KB
update.html 6KB
update.html 6KB
updateadmin.html 6KB
forget.html 4KB
forget.html 4KB
1239239569593.html 661B
1223193733625.html 659B
1223176735468.html 659B
1223182170734.html 659B
1223182172125.html 659B
1223195847203.html 659B
1223181599218.html 659B
1223181658703.html 659B
1239238767234.html 659B
1223181626468.html 659B
1223182165140.html 659B
1223182174031.html 659B
1223176973359.html 659B
1223199235593.html 659B
1223176736625.html 659B
1223182167140.html 659B
1223193483015.html 659B
1223176899500.html 659B
1223176922625.html 659B
1223199304812.html 659B
1223184792500.html 659B
1223181665593.html 659B
1223182172500.html 659B
1223193455296.html 659B
1223184336328.html 659B
1223190966875.html 659B
1223182171203.html 659B
1239238279921.html 659B
1223188139234.html 659B
1223196020703.html 659B
1223182171718.html 659B
1223197325781.html 659B
1223184792453.html 655B
1223181665546.html 655B
1223181658687.html 655B
1223182170593.html 655B
1223188139187.html 655B
共 218 条
- 1
- 2
- 3
bumie2008
- 粉丝: 7
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页