This commit is contained in:
ag2s20150909
2023-03-13 08:50:02 +08:00
parent 961e191a8a
commit f267c002e8
2 changed files with 25 additions and 1 deletions
@@ -11,12 +11,25 @@ import java.io.InputStream
@Keep @Keep
@Suppress("unused","MemberVisibilityCanBePrivate") @Suppress("unused","MemberVisibilityCanBePrivate")
object RarUtils { 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?) { fun unRarToPath(inputStream: InputStream, destDir: File?) {
Archive(inputStream).use { Archive(inputStream).use {
unRarToPath(it, destDir) unRarToPath(it, destDir)
} }
inputStream.close() inputStream.close()
} }
fun unRarToPath(byteArray: ByteArray, destDir: File?) { fun unRarToPath(byteArray: ByteArray, destDir: File?) {
Archive(ByteArrayInputStream(byteArray)).use { Archive(ByteArrayInputStream(byteArray)).use {
unRarToPath(it, destDir) unRarToPath(it, destDir)
@@ -15,7 +15,18 @@ import java.nio.channels.FileChannel
@Suppress("unused","MemberVisibilityCanBePrivate") @Suppress("unused","MemberVisibilityCanBePrivate")
object SevenZipUtils { 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?){ fun un7zToPath(inputStream: InputStream, destDir: File?){
un7zToPath(SevenZFile(SeekableInMemoryByteChannel(inputStream.readBytes())),destDir) un7zToPath(SevenZFile(SeekableInMemoryByteChannel(inputStream.readBytes())),destDir)