''' <summary> ''' ファイル圧縮 ''' </summary> ''' <param name="inputFileName">入力ファイル</param> ''' <param name="outputFileName">出力ファイル</param> ''' <remarks></remarks> Public Shared Sub Zipper(ByVal inputFileName As String, ByVal outputFileName As String) Dim buffer(2048) As System.SByte Dim fis As FileInputStream = Nothing Dim fos As FileOutputStream = Nothing Dim zos As zip.ZipOutputStream = Nothing Try 'FileInputStreamの作成 fis = New FileInputStream(inputFileName) 'ZipOutputStreamの作成 fos = New FileOutputStream(outputFileName) zos = New zip.ZipOutputStream(fos) 'ZIPに追加するときのファイル名を決定する Dim fileName As String = Path.GetFileName(inputFileName) Dim ze As New zip.ZipEntry(fileName) ze.setMethod(zip.ZipEntry.DEFLATED) zos.putNextEntry(ze) '書込み While True Dim len As Integer len = fis.read(buffer, 0, buffer.Length) If len <= 0 Then Exit While End If zos.write(buffer, 0, len) End While Catch ex As Exception Throw ex Finally If Not fis Is Nothing Then fis.close() End If If Not zos Is Nothing Then zos.close() fos.close() End If End Try End Sub 需要添加vjslib.dll并引用 java.io 和 java.util命名空间