Skip to content

Commit 905d881

Browse files
committed
Rename LazyByteData to LazyMemorySegment
1 parent c30bbca commit 905d881

6 files changed

+26
-26
lines changed

src/main/java/software/coley/lljzip/format/model/AbstractZipFileHeader.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import software.coley.lljzip.format.compression.Decompressor;
44
import software.coley.lljzip.format.compression.ZipCompressions;
55
import software.coley.lljzip.util.MemorySegmentUtil;
6-
import software.coley.lljzip.util.lazy.LazyByteData;
6+
import software.coley.lljzip.util.lazy.LazyMemorySegment;
77
import software.coley.lljzip.util.lazy.LazyInt;
88
import software.coley.lljzip.util.lazy.LazyLong;
99

@@ -28,8 +28,8 @@ public abstract class AbstractZipFileHeader implements ZipPart, ZipRead {
2828
protected LazyLong uncompressedSize;
2929
protected LazyInt fileNameLength;
3030
protected LazyInt extraFieldLength;
31-
protected LazyByteData fileName;
32-
protected LazyByteData extraField;
31+
protected LazyMemorySegment fileName;
32+
protected LazyMemorySegment extraField;
3333

3434
// Offset into the data this part is read from
3535
protected transient long offset = -1L;

src/main/java/software/coley/lljzip/format/model/AdaptingLocalFileHeader.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package software.coley.lljzip.format.model;
22

3-
import software.coley.lljzip.util.lazy.LazyByteData;
3+
import software.coley.lljzip.util.lazy.LazyMemorySegment;
44
import software.coley.lljzip.util.lazy.LazyInt;
55
import software.coley.lljzip.util.lazy.LazyLong;
66

@@ -44,19 +44,19 @@ public AdaptingLocalFileHeader(@Nonnull ZipFile archive, @Nonnull ZipEntry entry
4444
lastModFileTime = new LazyInt(() -> 0);
4545
lastModFileDate = new LazyInt(() -> 0);
4646
fileNameLength = new LazyInt(entryName::length);
47-
fileName = new LazyByteData(() -> MemorySegment.ofArray(entryName.getBytes()));
47+
fileName = new LazyMemorySegment(() -> MemorySegment.ofArray(entryName.getBytes()));
4848
fileDataLength = new LazyLong(() -> entryData.length);
49-
fileData = new LazyByteData(() -> MemorySegment.ofArray(entryData));
49+
fileData = new LazyMemorySegment(() -> MemorySegment.ofArray(entryData));
5050
compressionMethod = new LazyInt(() -> 0);
5151
uncompressedSize = new LazyLong(() -> entryData.length);
5252
compressedSize = new LazyLong(() -> entryData.length);
5353
crc32 = new LazyInt(() -> (int) entry.getCrc());
5454
if (extra != null) {
5555
extraFieldLength = new LazyInt(() -> extra.length);
56-
extraField = new LazyByteData(() -> MemorySegment.ofArray(extra));
56+
extraField = new LazyMemorySegment(() -> MemorySegment.ofArray(extra));
5757
} else {
5858
extraFieldLength = new LazyInt(() -> 0);
59-
extraField = new LazyByteData(() -> MemorySegment.ofArray(new byte[0]));
59+
extraField = new LazyMemorySegment(() -> MemorySegment.ofArray(new byte[0]));
6060
}
6161
data = MemorySegment.ofArray(new byte[0]);
6262
}

src/main/java/software/coley/lljzip/format/model/CentralDirectoryFileHeader.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package software.coley.lljzip.format.model;
22

33
import software.coley.lljzip.util.MemorySegmentUtil;
4-
import software.coley.lljzip.util.lazy.LazyByteData;
4+
import software.coley.lljzip.util.lazy.LazyMemorySegment;
55
import software.coley.lljzip.util.lazy.LazyInt;
66
import software.coley.lljzip.util.lazy.LazyLong;
77

@@ -43,7 +43,7 @@ public class CentralDirectoryFileHeader extends AbstractZipFileHeader {
4343
// CentralDirectoryFileHeader spec (plus common elements between this and local file)
4444
private LazyInt versionMadeBy;
4545
private LazyInt fileCommentLength;
46-
private LazyByteData fileComment;
46+
private LazyMemorySegment fileComment;
4747
private LazyInt diskNumberStart;
4848
private LazyInt internalFileAttributes;
4949
private LazyInt externalFileAttributes;

src/main/java/software/coley/lljzip/format/model/LocalFileHeader.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import software.coley.lljzip.format.compression.Decompressor;
44
import software.coley.lljzip.format.read.ZipReader;
55
import software.coley.lljzip.util.MemorySegmentUtil;
6-
import software.coley.lljzip.util.lazy.LazyByteData;
6+
import software.coley.lljzip.util.lazy.LazyMemorySegment;
77
import software.coley.lljzip.util.lazy.LazyInt;
88
import software.coley.lljzip.util.lazy.LazyLong;
99

@@ -42,7 +42,7 @@ public class LocalFileHeader extends AbstractZipFileHeader {
4242
protected transient CentralDirectoryFileHeader linkedDirectoryFileHeader;
4343

4444
// LocalFileHeader spec (plus common elements between this and central file)
45-
protected LazyByteData fileData;
45+
protected LazyMemorySegment fileData;
4646

4747
// Caches
4848
protected transient LazyLong fileDataLength;

src/main/java/software/coley/lljzip/util/MemorySegmentUtil.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package software.coley.lljzip.util;
22

33
import software.coley.lljzip.format.model.ZipPart;
4-
import software.coley.lljzip.util.lazy.LazyByteData;
4+
import software.coley.lljzip.util.lazy.LazyMemorySegment;
55
import software.coley.lljzip.util.lazy.LazyInt;
66
import software.coley.lljzip.util.lazy.LazyLong;
77

@@ -399,8 +399,8 @@ public static LazyLong readLazyMaskedLongQuad(MemorySegment data, long headerOff
399399
*
400400
* @return Lazily populated slice.
401401
*/
402-
public static LazyByteData readLazySlice(MemorySegment data, long headerOffset, LazyInt localOffset, LazyInt length) {
403-
return new LazyByteData(() -> {
402+
public static LazyMemorySegment readLazySlice(MemorySegment data, long headerOffset, LazyInt localOffset, LazyInt length) {
403+
return new LazyMemorySegment(() -> {
404404
return data.asSlice(headerOffset + localOffset.get(), length.get());
405405
});
406406
}
@@ -415,8 +415,8 @@ public static LazyByteData readLazySlice(MemorySegment data, long headerOffset,
415415
*
416416
* @return Lazily populated long slice.
417417
*/
418-
public static LazyByteData readLazyLongSlice(MemorySegment data, long headerOffset, LazyInt localOffset, LazyLong length) {
419-
return new LazyByteData(() -> {
418+
public static LazyMemorySegment readLazyLongSlice(MemorySegment data, long headerOffset, LazyInt localOffset, LazyLong length) {
419+
return new LazyMemorySegment(() -> {
420420
return data.asSlice(headerOffset + localOffset.get(), length.get());
421421
});
422422
}
@@ -431,8 +431,8 @@ public static LazyByteData readLazyLongSlice(MemorySegment data, long headerOffs
431431
*
432432
* @return Lazily populated long slice.
433433
*/
434-
public static LazyByteData readLazyLongSlice(MemorySegment data, long headerOffset, LazyLong localOffset, LazyLong length) {
435-
return new LazyByteData(() -> {
434+
public static LazyMemorySegment readLazyLongSlice(MemorySegment data, long headerOffset, LazyLong localOffset, LazyLong length) {
435+
return new LazyMemorySegment(() -> {
436436
return data.asSlice(headerOffset + localOffset.get(), length.get());
437437
});
438438
}
@@ -447,8 +447,8 @@ public static LazyByteData readLazyLongSlice(MemorySegment data, long headerOffs
447447
*
448448
* @return Lazily populated long slice.
449449
*/
450-
public static LazyByteData readLazyLongSlice(MemorySegment data, long headerOffset, LazyInt localOffset, long length) {
451-
return new LazyByteData(() -> {
450+
public static LazyMemorySegment readLazyLongSlice(MemorySegment data, long headerOffset, LazyInt localOffset, long length) {
451+
return new LazyMemorySegment(() -> {
452452
return data.asSlice(headerOffset + localOffset.get(), length);
453453
});
454454
}

src/main/java/software/coley/lljzip/util/lazy/LazyByteData.java src/main/java/software/coley/lljzip/util/lazy/LazyMemorySegment.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@
88
/**
99
* Lazy {@link MemorySegment} getter.
1010
*/
11-
public class LazyByteData extends Lazy<Supplier<MemorySegment>> {
11+
public class LazyMemorySegment extends Lazy<Supplier<MemorySegment>> {
1212
private MemorySegment value;
1313

1414
/**
1515
* @param lookup
1616
* Lazy lookup.
1717
*/
18-
public LazyByteData(@Nonnull Supplier<MemorySegment> lookup) {
18+
public LazyMemorySegment(@Nonnull Supplier<MemorySegment> lookup) {
1919
super(lookup);
2020
}
2121

2222
/**
2323
* @return Copy.
2424
*/
2525
@Nonnull
26-
public LazyByteData copy() {
27-
LazyByteData copy = new LazyByteData(lookup);
26+
public LazyMemorySegment copy() {
27+
LazyMemorySegment copy = new LazyMemorySegment(lookup);
2828
copy.id = id;
2929
if (set) copy.set(value);
3030
return copy;
@@ -61,7 +61,7 @@ public boolean equals(Object o) {
6161
if (this == o) return true;
6262
if (o == null || getClass() != o.getClass()) return false;
6363

64-
LazyByteData that = (LazyByteData) o;
64+
LazyMemorySegment that = (LazyMemorySegment) o;
6565

6666
return Objects.equals(get(), that.get());
6767
}

0 commit comments

Comments
 (0)