Skip to content

Commit

Permalink
Javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Feb 4, 2025
1 parent 96385a6 commit 0df4e0f
Show file tree
Hide file tree
Showing 13 changed files with 312 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,72 +38,78 @@ public class ArjArchiveEntry implements ArchiveEntry {
public static class HostOs {

/**
* {@value}
* Constant value {@value}.
*/
public static final int DOS = 0;

/**
* {@value}
* Constant value {@value}.
*/
public static final int PRIMOS = 1;

/**
* {@value}
* Constant value {@value}.
*/
public static final int UNIX = 2;

/**
* {@value}
* Constant value {@value}.
*/
public static final int AMIGA = 3;

/**
* {@value}
* Constant value {@value}.
*/
public static final int MAC_OS = 4;

/**
* {@value}
* Constant value {@value}.
*/
public static final int OS_2 = 5;

/**
* {@value}
* Constant value {@value}.
*/
public static final int APPLE_GS = 6;

/**
* {@value}
* Constant value {@value}.
*/
public static final int ATARI_ST = 7;

/**
* {@value}
* Constant value {@value}.
*/
public static final int NEXT = 8;

/**
* {@value}
* Constant value {@value}.
*/
public static final int VAX_VMS = 9;

/**
* {@value}
* Constant value {@value}.
*/
public static final int WIN95 = 10;

/**
* {@value}
* Constant value {@value}.
*/
public static final int WIN32 = 11;
}

private final LocalFileHeader localFileHeader;

/**
* Constructs a new instance.
*/
public ArjArchiveEntry() {
localFileHeader = new LocalFileHeader();
}

/**
* Constructs a new instance.
*/
ArjArchiveEntry(final LocalFileHeader localFileHeader) {
this.localFileHeader = localFileHeader;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,31 @@
* Various constants associated with dump archives.
*/
public final class DumpArchiveConstants {

/**
* The type of compression.
* Enumerates compression types.
*/
public enum COMPRESSION_TYPE {
UNKNOWN(-1), ZLIB(0), BZLIB(1), LZO(2);

/**
* Compression code is -1.
*/
UNKNOWN(-1),

/**
* Compression code is 0.
*/
ZLIB(0),

/**
* Compression code is 1.
*/
BZLIB(1),

/**
* Compression code is 2.
*/
LZO(2);

public static COMPRESSION_TYPE find(final int code) {
for (final COMPRESSION_TYPE t : values()) {
Expand All @@ -46,10 +66,39 @@ public static COMPRESSION_TYPE find(final int code) {
}

/**
* The type of tape segment.
* Enumerates the types of tape segment.
*/
public enum SEGMENT_TYPE {
TAPE(1), INODE(2), BITS(3), ADDR(4), END(5), CLRI(6);

/**
* TAPE with code 1.
*/
TAPE(1),

/**
* INODE with code 2.
*/
INODE(2),

/**
* BITS with code 3.
*/
BITS(3),

/**
* ADDR with code 4.
*/
ADDR(4),

/**
* END with code 5.
*/
END(5),

/**
* CLRI with code 6.
*/
CLRI(6);

public static SEGMENT_TYPE find(final int code) {
for (final SEGMENT_TYPE t : values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,22 +173,71 @@
*/
public class DumpArchiveEntry implements ArchiveEntry {

/**
* Enumerates permissions with values.
*/
public enum PERMISSION {
// Note: The arguments are octal values
// @formatter:off

/**
* Permission SETUID (octal value 04000).
*/
SETUID(04000),

/**
* Permission SETGUI (octal value 02000).
*/
SETGUI(02000),

/**
* Permission STICKY (octal value 01000).
*/
STICKY(01000),

/**
* Permission USER_READ (octal value 00400).
*/
USER_READ(00400),

/**
* Permission USER_WRITE (octal value 00200).
*/
USER_WRITE(00200),

/**
* Permission USER_EXEC (octal value 00100).
*/
USER_EXEC(00100),

/**
* Permission GROUP_READ (octal value 00040).
*/
GROUP_READ(00040),

/**
* Permission GROUP_WRITE (octal value 00020).
*/
GROUP_WRITE(00020),

/**
* Permission 00020 (octal value 00010).
*/
GROUP_EXEC(00010),

/**
* Permission WORLD_READ (octal value 00004).
*/
WORLD_READ(00004),

/**
* Permission WORLD_WRITE (octal value 00002).
*/
WORLD_WRITE(00002),

/**
* Permission WORLD_EXEC (octal value 00001).
*/
WORLD_EXEC(00001);
// @formatter:on

public static Set<PERMISSION> find(final int code) {
final Set<PERMISSION> set = new HashSet<>();
Expand Down Expand Up @@ -253,8 +302,55 @@ void setIno(final int ino) {
}
}

/**
* Enumerates types.
*/
public enum TYPE {
WHITEOUT(14), SOCKET(12), LINK(10), FILE(8), BLKDEV(6), DIRECTORY(4), CHRDEV(2), FIFO(1), UNKNOWN(15);

/**
* WHITEOUT with code 14.
*/
WHITEOUT(14),

/**
* SOCKET with code 12.
*/
SOCKET(12),

/**
* LINK with code 10.
*/
LINK(10),

/**
* FILE with code 8.
*/
FILE(8),

/**
* BLKDEV with code 6.
*/
BLKDEV(6),

/**
* DIRECTORY with code 4.
*/
DIRECTORY(4),

/**
* CHRDEV with code 2.
*/
CHRDEV(2),

/**
* CHRDEV with code 1.
*/
FIFO(1),

/**
* UNKNOWN with code 15.
*/
UNKNOWN(15);

public static TYPE find(final int code) {
TYPE type = UNKNOWN;
Expand Down Expand Up @@ -636,16 +732,16 @@ public int hashCode() {
}

/**
* Is this a block device?
* Tests whether this is a block device.
*
* @return whether this is a block device
* @return whether this is a block device.
*/
public boolean isBlkDev() {
return type == TYPE.BLKDEV;
}

/**
* Is this a character device?
* Tests whether this is a character device.
*
* @return whether this is a character device
*/
Expand All @@ -654,16 +750,17 @@ public boolean isChrDev() {
}

/**
* Has this file been deleted? (On valid on incremental dumps.)
* Tests whether this file been deleted.
* For valid on incremental dumps.
*
* @return whether the file has been deleted
* @return whether the file has been deleted.
*/
public boolean isDeleted() {
return isDeleted;
}

/**
* Is this a directory?
* Tests whether this is a directory.
*
* @return whether this is a directory
*/
Expand All @@ -673,37 +770,37 @@ public boolean isDirectory() {
}

/**
* Is this a fifo/pipe?
* Tests whether whether this is a fifo/pipe.
*
* @return whether this is a fifo
* @return whether this is a fifo/pipe.
*/
public boolean isFifo() {
return type == TYPE.FIFO;
}

/**
* Is this a regular file?
* Tests whether this is a regular file.
*
* @return whether this is a regular file
* @return whether this is a regular file.
*/
public boolean isFile() {
return type == TYPE.FILE;
}

/**
* Is this a network device?
* Tests whether this is a socket.
*
* @return whether this is a socket
* @return whether this is a socket.
*/
public boolean isSocket() {
return type == TYPE.SOCKET;
}

/**
* Is this a sparse record?
* Tests whether this is a sparse record.
*
* @param idx index of the record to check
* @return whether this is a sparse record
* @param idx index of the record to check.
* @return whether this is a sparse record.
*/
public boolean isSparseRecord(final int idx) {
return (header.getCdata(idx) & 0x01) == 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
*/
public class CLI {

/**
* Enumerates modes.
*/
private enum Mode {
LIST("Analysing") {
private String getContentMethods(final SevenZArchiveEntry entry) {
Expand Down
Loading

0 comments on commit 0df4e0f

Please sign in to comment.