Setup CI testing and building (#1)
All checks were successful
Test Workflow / Lint and test library (push) Successful in 17m20s
All checks were successful
Test Workflow / Lint and test library (push) Successful in 17m20s
We want CI to be able to build the ShadowJAR for the CLI tool. Reviewed-on: #1
This commit is contained in:
@@ -3,6 +3,9 @@ package ziputils
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
|
||||
/**
|
||||
* Represents a partial ZIP central directory file header.
|
||||
*/
|
||||
internal class CentralDirectoryFileHeader(
|
||||
val compressedSize: UInt,
|
||||
val uncompressedSize: UInt,
|
||||
@@ -22,8 +25,11 @@ internal class CentralDirectoryFileHeader(
|
||||
const val SIZE = 46
|
||||
|
||||
/**
|
||||
* Create CentralDirectoryFileHeader from raw byte data.
|
||||
* @throws InvalidDataException provided ByteArray is not a supported CEN.
|
||||
* Create `CentralDirectoryFileHeader` from raw byte data.
|
||||
* @throws InvalidDataException provided `ByteArray` is not a supported CEN.
|
||||
* @param data Raw byte data.
|
||||
* @param offset Skip first <offset> bytes in data array.
|
||||
* @return A `CentralDirectoryFileHeader`.
|
||||
*/
|
||||
@Throws(InvalidDataException::class)
|
||||
fun fromByteArray(data: ByteArray, offset: Int): CentralDirectoryFileHeader {
|
||||
|
@@ -3,12 +3,22 @@ package ziputils
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
|
||||
/**
|
||||
* Represents a partial ZIP64 end of central directory locator.
|
||||
*/
|
||||
internal class EndOfCentralDirectoryLocator(
|
||||
val endOfCentralDirectory64Offset: ULong
|
||||
) {
|
||||
companion object {
|
||||
const val SIGNATURE = 0x07064b50U
|
||||
const val SIZE = 20
|
||||
/**
|
||||
* Create `EndOfCentralDirectoryLocator` from raw byte data.
|
||||
* @throws InvalidDataException Provided `ByteArray` is not a supported EOCD locator.
|
||||
* @param data Raw byte data.
|
||||
* @param offset Skip first <offset> bytes in data array.
|
||||
* @return A `EndOfCentralDirectoryLocator`.
|
||||
*/
|
||||
@Throws(InvalidDataException::class)
|
||||
fun fromByteArray(data: ByteArray, offset: Int): EndOfCentralDirectoryLocator {
|
||||
if (data.size - offset < SIZE) {
|
||||
|
@@ -4,8 +4,7 @@ import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
|
||||
/**
|
||||
* Partial End of Central Directory record class.
|
||||
* Only supports data required by the backup tool.
|
||||
* Represents a partial ZIP end of central directory record.
|
||||
*/
|
||||
internal class EndOfCentralDirectoryRecord(
|
||||
val centralDirectoryOffset: UInt
|
||||
@@ -17,8 +16,11 @@ internal class EndOfCentralDirectoryRecord(
|
||||
const val SIGNATURE = 0x06054b50U
|
||||
const val SIZE = 22
|
||||
/**
|
||||
* Create EndOfCentralDirectoryRecord from raw byte data.
|
||||
* @throws InvalidDataException provided ByteArray is not a supported EOCD64.
|
||||
* Create `EndOfCentralDirectoryRecord` from raw byte data.
|
||||
* @throws InvalidDataException Provided `ByteArray` is not a supported EOCD64.
|
||||
* @param data Raw byte data.
|
||||
* @param offset Skip first <offset> bytes in data array.
|
||||
* @return A `EndOfCentralDirectoryRecord`.
|
||||
*/
|
||||
@Throws(InvalidDataException::class)
|
||||
fun fromByteArray(data: ByteArray, offset: Int): EndOfCentralDirectoryRecord {
|
||||
|
@@ -4,8 +4,7 @@ import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
|
||||
/**
|
||||
* Partial End of Central Directory record (ZIP64) class.
|
||||
* Only supports data required by the backup tool.
|
||||
* Represents a partial ZIP64 end of central directory record.
|
||||
*/
|
||||
internal class EndOfCentralDirectoryRecord64(
|
||||
val centralDirectoryOffset: ULong
|
||||
@@ -14,8 +13,11 @@ internal class EndOfCentralDirectoryRecord64(
|
||||
const val SIGNATURE = 0x06064b50U
|
||||
const val SIZE = 56
|
||||
/**
|
||||
* Create EndOfCentralDirectoryRecord64 from raw byte data.
|
||||
* @throws InvalidDataException provided ByteArray is not a supported EOCD.
|
||||
* Create `EndOfCentralDirectoryRecord64` from raw byte data.
|
||||
* @throws InvalidDataException Provided `ByteArray` is not a supported EOCD.
|
||||
* @param data Raw byte data.
|
||||
* @param offset Skip first <offset> bytes in data array.
|
||||
* @return A `EndOfCentralDirectoryRecord64`.
|
||||
*/
|
||||
@Throws(InvalidDataException::class)
|
||||
fun fromByteArray(data: ByteArray, offset: Int): EndOfCentralDirectoryRecord64 {
|
||||
|
@@ -1,4 +1,11 @@
|
||||
package ziputils
|
||||
|
||||
/**
|
||||
* Represents an invalid raw byte data exception.
|
||||
*/
|
||||
class InvalidDataException(message: String): Exception(message)
|
||||
|
||||
/**
|
||||
* Represents an invalid raw byte signature exception.
|
||||
*/
|
||||
class InvalidSignatureException(message: String): Exception(message)
|
||||
|
@@ -1,5 +1,8 @@
|
||||
package ziputils
|
||||
|
||||
/**
|
||||
* Represents a partial ZIP extra field record.
|
||||
*/
|
||||
internal open class ExtraFieldRecord(
|
||||
val id: UShort,
|
||||
val size: UShort
|
||||
|
@@ -1,5 +1,8 @@
|
||||
package ziputils
|
||||
|
||||
/**
|
||||
* Represents a ZIP ZIP64 extra field record (ID 0x0001).
|
||||
*/
|
||||
internal class Zip64ExtraFieldRecord(
|
||||
size: UShort,
|
||||
val uncompressedSize: ULong?,
|
||||
|
Reference in New Issue
Block a user