Skip to content

Commit 8709dcd

Browse files
committed
Integrata correzione "Fix a bug in file times and expose the headers"
edmund-wagner/junrar#20 tmyroadctfig
1 parent d349dfe commit 8709dcd

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/main/java/com/github/junrar/Archive.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,15 @@ public IReadOnlyAccess getRof() {
167167
return rof;
168168
}
169169

170+
/**
171+
* Gets all of the headers in the archive.
172+
*
173+
* @return returns the headers.
174+
*/
175+
public List<BaseBlock> getHeaders() {
176+
return new ArrayList<BaseBlock>(headers);
177+
}
178+
170179
/**
171180
* @return returns all file headers of the archive
172181
*/
@@ -429,7 +438,7 @@ private void readHeaders(long fileLength) throws IOException, RarException {
429438
* Extract the file specified by the given header and write it to the
430439
* supplied output stream
431440
*
432-
* @param header
441+
* @param hd
433442
* the header to be extracted
434443
* @param os
435444
* the outputstream
@@ -455,7 +464,7 @@ public void extractFile(FileHeader hd, OutputStream os) throws RarException {
455464
* stream it. Please note that this method will create a new Thread and an a
456465
* pair of Pipe streams.
457466
*
458-
* @param header
467+
* @param hd
459468
* the header to be extracted
460469
* @throws RarException
461470
* @throws IOException

src/main/java/com/github/junrar/rarfile/FileHeader.java

+1
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ private Date getDateDos(int time) {
230230
cal.set(Calendar.HOUR_OF_DAY, (time >>> 11) & 0x1f);
231231
cal.set(Calendar.MINUTE, (time >>> 5) & 0x3f);
232232
cal.set(Calendar.SECOND, (time & 0x1f) * 2);
233+
cal.set(Calendar.MILLISECOND, 0);
233234
return cal.getTime();
234235
}
235236

0 commit comments

Comments
 (0)