This commit is contained in:
ag2s20150909
2023-03-13 08:50:02 +08:00
parent b6abf3b04a
commit 20a3ea09b4
2 changed files with 25 additions and 1 deletions

View File

@@ -11,12 +11,25 @@ import java.io.InputStream
@Keep
@Suppress("unused","MemberVisibilityCanBePrivate")
object RarUtils {
fun unRarToPath(inputStream: InputStream,path:String){
unRarToPath(inputStream, File(path))
}
fun unRarToPath(byteArray: ByteArray,path:String){
unRarToPath(byteArray, File(path))
}
fun unRarToPath(zipPath:String,path:String){
unRarToPath(zipPath, File(path))
}
fun unRarToPath(file: File,path:String){
unRarToPath(file, File(path))
}
fun unRarToPath(inputStream: InputStream, destDir: File?) {
Archive(inputStream).use {
unRarToPath(it, destDir)
}
inputStream.close()
}
fun unRarToPath(byteArray: ByteArray, destDir: File?) {
Archive(ByteArrayInputStream(byteArray)).use {
unRarToPath(it, destDir)

View File

@@ -15,7 +15,18 @@ import java.nio.channels.FileChannel
@Suppress("unused","MemberVisibilityCanBePrivate")
object SevenZipUtils {
fun un7zToPath(inputStream: InputStream, path:String){
un7zToPath(inputStream,File(path))
}
fun un7zToPath(byteArray: ByteArray, path:String){
un7zToPath(byteArray,File(path))
}
fun un7zToPath(pfd: ParcelFileDescriptor, path:String){
un7zToPath(pfd,File(path))
}
fun un7zToPath(fileChannel: FileChannel, path:String){
un7zToPath(fileChannel,File(path))
}
fun un7zToPath(inputStream: InputStream, destDir: File?){
un7zToPath(SevenZFile(SeekableInMemoryByteChannel(inputStream.readBytes())),destDir)