96 lines
3.0 KiB
Java
Generated
96 lines
3.0 KiB
Java
Generated
// This file is auto-generated by alef — DO NOT EDIT.
|
|
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
|
|
// To regenerate: alef generate
|
|
// To verify freshness: alef verify --exit-code
|
|
// Issues & docs: https://github.com/kreuzberg-dev/alef
|
|
package dev.kreuzberg;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
|
|
import org.jspecify.annotations.Nullable;
|
|
|
|
/**
|
|
* Embedded file descriptor extracted from the PDF name tree.
|
|
*/
|
|
@JsonInclude(JsonInclude.Include.NON_ABSENT)
|
|
@JsonDeserialize(builder = EmbeddedFile.Builder.class)
|
|
public record EmbeddedFile(
|
|
/**
|
|
* The filename as stored in the PDF name tree.
|
|
*/
|
|
@JsonProperty("name") String name,
|
|
/**
|
|
* Raw file bytes from the embedded stream (already decompressed by lopdf).
|
|
*/
|
|
@JsonSerialize(using = ByteArrayToIntArraySerializer.class) @JsonProperty("data") byte[] data,
|
|
/**
|
|
* Compressed byte count of the original stream (before decompression).
|
|
*
|
|
* Used by callers to compute the decompression ratio and detect zip-bomb-style
|
|
* attacks that embed a tiny compressed stream expanding to gigabytes of data.
|
|
*/
|
|
@JsonProperty("compressed_size") long compressedSize,
|
|
/**
|
|
* MIME type if specified in the filespec, otherwise {@code None}.
|
|
*/
|
|
@Nullable @JsonProperty("mime_type") String mimeType
|
|
) {
|
|
public static Builder builder() {
|
|
return new Builder();
|
|
}
|
|
|
|
// CPD-OFF
|
|
@JsonPOJOBuilder(withPrefix = "with", buildMethodName = "build")
|
|
public static final class Builder {
|
|
|
|
private String name = "";
|
|
private byte[] data = new byte[0];
|
|
@JsonProperty("compressed_size")
|
|
private long compressedSize = 0;
|
|
@JsonProperty("mime_type")
|
|
private String mimeType = null;
|
|
|
|
/** Sets the name field. */
|
|
@JsonProperty("name")
|
|
public Builder withName(final String value) {
|
|
this.name = value;
|
|
return this;
|
|
}
|
|
|
|
/** Sets the data field. */
|
|
@JsonProperty("data")
|
|
public Builder withData(final byte[] value) {
|
|
this.data = value;
|
|
return this;
|
|
}
|
|
|
|
/** Sets the compressedSize field. */
|
|
@JsonProperty("compressed_size")
|
|
public Builder withCompressedSize(final long value) {
|
|
this.compressedSize = value;
|
|
return this;
|
|
}
|
|
|
|
/** Sets the mimeType field. */
|
|
@JsonProperty("mime_type")
|
|
public Builder withMimeType(final @Nullable String value) {
|
|
this.mimeType = value;
|
|
return this;
|
|
}
|
|
|
|
/** Builds the EmbeddedFile instance. */
|
|
public EmbeddedFile build() {
|
|
return new EmbeddedFile(
|
|
name,
|
|
data,
|
|
compressedSize,
|
|
mimeType
|
|
);
|
|
}
|
|
}
|
|
// CPD-ON
|
|
}
|