新聞中心
JAVA源代碼
Java本身API的代碼也是開(kāi)源的,可以打開(kāi)您所安裝的JDK入面的jar包,可以看到JavaAPI的內(nèi)部構(gòu)造和寫法?;蛘呤褂糜嘘P(guān)開(kāi)發(fā)工具(如Jbuilder)入面的查看定議的功能,跳轉(zhuǎn)到Java API的代碼定義處。
創(chuàng)新互聯(lián)公司是一家從事企業(yè)網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)制作、做網(wǎng)站、行業(yè)門戶網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)制作的專業(yè)的建站公司,擁有經(jīng)驗(yàn)豐富的網(wǎng)站建設(shè)工程師和網(wǎng)頁(yè)設(shè)計(jì)人員,具備各種規(guī)模與類型網(wǎng)站建設(shè)的實(shí)力,在網(wǎng)站建設(shè)領(lǐng)域樹(shù)立了自己獨(dú)特的設(shè)計(jì)風(fēng)格。自公司成立以來(lái)曾獨(dú)立設(shè)計(jì)制作的站點(diǎn)超過(guò)千家。
求一個(gè)JAVA的壓縮程序源代碼。
package com.io2.homework;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/*壓縮文件夾*/
public class MyMultipleFileZip
{
private String currentZipFilePath = "F:/MyZip.zip";
private String sourceFilePath;
private ZipOutputStream zos;
private FileInputStream fis;
public MyMultipleFileZip(String sourceFilePath)
{
try
{
this.sourceFilePath = sourceFilePath;
zos = new ZipOutputStream(new FileOutputStream(currentZipFilePath));
//設(shè)定文件壓縮級(jí)別
zos.setLevel(9);
} catch (FileNotFoundException e)
{
e.printStackTrace();
}
}
// 在當(dāng)前條目中寫入具體內(nèi)容
public void writeToEntryZip(String filePath)
{
try
{
fis = new FileInputStream(filePath);
} catch (FileNotFoundException e1)
{
e1.printStackTrace();
}
byte[] buff = new byte[1024];
int len = 0;
try
{
while ((len = fis.read(buff)) != -1)
{
zos.write(buff, 0, len);
}
} catch (IOException e)
{
e.printStackTrace();
}finally
{
if (fis != null)
try
{
fis.close();
} catch (IOException e)
{
e.printStackTrace();
}
}
}
// 添加文件條目
public void addFileEntryZip(String fileName)
{
try
{
zos.putNextEntry(new ZipEntry(fileName));
} catch (IOException e)
{
e.printStackTrace();
}
}
public void addDirectoryEntryZip(String directoryName)
{
try
{
zos.putNextEntry(new ZipEntry(directoryName + "/"));
} catch (IOException e)
{
e.printStackTrace();
}
}
// 遍歷文件夾
public void listMyDirectory(String filePath)
{
File f = new File(filePath);
File[] files = f.listFiles();
if(files!=null)
{
for (File currentFile : files)
{
// 設(shè)置條目名稱(此步驟非常關(guān)鍵)
String entryName= currentFile.getAbsolutePath().split(":")[1].substring(1);
// 獲取文件物理路徑
String absolutePath = currentFile.getAbsolutePath();
if (currentFile.isDirectory())
{
addDirectoryEntryZip(entryName);
//進(jìn)行遞歸調(diào)用
listMyDirectory(absolutePath);
}
else
{
addFileEntryZip(entryName);
writeToEntryZip(absolutePath);
}
}
}
}
// 主要流程
public void mainWorkFlow()
{
listMyDirectory(this.sourceFilePath);
if(zos!=null)
try
{
zos.close();
} catch (IOException e)
{
e.printStackTrace();
}
}
public static void main(String[] args)
{
new MyMultipleFileZip("F:/fountainDirectory").mainWorkFlow();
}
}
求java源代碼
BS 架構(gòu)很好做??!就是單表 select \ insert update delete 操作, 這個(gè)功能很好寫的,你說(shuō)的這些代碼,有些還可以用工具生成
急需一段用純JAVA語(yǔ)言編的21點(diǎn)紙牌游戲的源代碼
請(qǐng)不要發(fā)違規(guī)廣告,是違法行為
請(qǐng)不要發(fā)違法消息,是違規(guī)的行為
請(qǐng)不要發(fā)違規(guī)廣告,是違法行為
急求JAVA源代碼
你這樣的需求,不要考慮太多的話,一個(gè)JSP頁(yè)面就能搞定了!很簡(jiǎn)單的東西,又不復(fù)雜,最基礎(chǔ)的應(yīng)用!
分享文章:要牌java源代碼 java發(fā)牌代碼
網(wǎng)頁(yè)網(wǎng)址:http://www.dlmjj.cn/article/doddpes.html