Skip to content

Commit f33b764

Browse files
committed
Specify name trust in javadocs for zip file header types
1 parent 0131d7e commit f33b764

File tree

3 files changed

+68
-6
lines changed

3 files changed

+68
-6
lines changed

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,6 @@ public void setExtraFieldLength(int extraFieldLength) {
225225
}
226226

227227
/**
228-
* Should match {@link LocalFileHeader#getFileName()} but is not a strict requirement.
229-
* If they do not match, trust this value instead.
230-
*
231228
* @return File name.
232229
*/
233230
public MemorySegment getFileName() {
@@ -244,9 +241,6 @@ public void setFileName(MemorySegment fileName) {
244241
}
245242

246243
/**
247-
* Should match {@link CentralDirectoryFileHeader#getFileName()} but is not a strict requirement.
248-
* If they do not match, the central directory file name should be trusted instead.
249-
*
250244
* @return File name.
251245
*/
252246
public String getFileNameAsString() {

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,38 @@ public PartType type() {
121121
return PartType.CENTRAL_DIRECTORY_FILE_HEADER;
122122
}
123123

124+
/**
125+
* Should match {@link LocalFileHeader#getFileNameLength()} but is not a strict requirement.
126+
* If they do not match, trust this value instead.
127+
*
128+
* @return File name length.
129+
*/
130+
@Override
131+
public int getFileNameLength() {
132+
return super.getFileNameLength();
133+
}
134+
135+
/**
136+
* Should match {@link LocalFileHeader#getFileName()} but is not a strict requirement.
137+
* If they do not match, trust this value instead.
138+
*
139+
* @return File name.
140+
*/
141+
@Override
142+
public MemorySegment getFileName() {
143+
return super.getFileName();
144+
}
145+
146+
/**
147+
* Should match {@link LocalFileHeader#getFileName()} but is not a strict requirement.
148+
* If they do not match, trust this value instead.
149+
*
150+
* @return File name.
151+
*/
152+
@Override
153+
public String getFileNameAsString() {
154+
return super.getFileNameAsString();
155+
}
124156

125157
/**
126158
* @return The file header associated with {@link #getRelativeOffsetOfLocalHeader()}. May be {@code null}.

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,42 @@ public void read(@Nonnull MemorySegment data, long offset) {
101101
fileNameLength.add(extraFieldLength).add(MIN_FIXED_SIZE), fileDataLength).withId("fileData");
102102
}
103103

104+
105+
106+
/**
107+
* Should match {@link CentralDirectoryFileHeader#getFileNameLength()} but is not a strict requirement.
108+
* If they do not match, the central directory file name length should be trusted instead.
109+
*
110+
* @return File name length.
111+
*/
112+
@Override
113+
public int getFileNameLength() {
114+
return super.getFileNameLength();
115+
}
116+
117+
/**
118+
* Should match {@link CentralDirectoryFileHeader#getFileName()} but is not a strict requirement.
119+
* If they do not match, the central directory file name should be trusted instead.
120+
*
121+
* @return File name.
122+
*/
123+
@Override
124+
public MemorySegment getFileName() {
125+
126+
return super.getFileName();
127+
}
128+
129+
/**
130+
* Should match {@link CentralDirectoryFileHeader#getFileName()} but is not a strict requirement.
131+
* If they do not match, the central directory file name should be trusted instead.
132+
*
133+
* @return File name.
134+
*/
135+
@Override
136+
public String getFileNameAsString() {
137+
return super.getFileNameAsString();
138+
}
139+
104140
/**
105141
* Checks if the contents do not match those described in {@link CentralDirectoryFileHeader}.
106142
* If this is the case you will probably want to change your ZIP reading configuration.

0 commit comments

Comments
 (0)