1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 */ 18 package org.apache.commons.compress.archivers.arj; 19 20 import java.util.Arrays; 21 22 class LocalFileHeader { 23 int archiverVersionNumber; 24 int minVersionToExtract; 25 int hostOS; 26 int arjFlags; 27 int method; 28 int fileType; 29 int reserved; 30 int dateTimeModified; 31 long compressedSize; 32 long originalSize; 33 long originalCrc32; 34 int fileSpecPosition; 35 int fileAccessMode; 36 int firstChapter; 37 int lastChapter; 38 39 int extendedFilePosition; 40 int dateTimeAccessed; 41 int dateTimeCreated; 42 int originalSizeEvenForVolumes; 43 44 String name; 45 String comment; 46 47 byte[][] extendedHeaders = null; 48 49 static class Flags { 50 static final int GARBLED = 0x01; 51 static final int VOLUME = 0x04; 52 static final int EXTFILE = 0x08; 53 static final int PATHSYM = 0x10; 54 static final int BACKUP = 0x20; 55 } 56 57 static class FileTypes { 58 static final int BINARY = 0; 59 static final int SEVEN_BIT_TEXT = 1; 60 static final int DIRECTORY = 3; 61 static final int VOLUME_LABEL = 4; 62 static final int CHAPTER_LABEL = 5; 63 } 64 65 static class Methods { 66 static final int STORED = 0; 67 static final int COMPRESSED_MOST = 1; 68 static final int COMPRESSED_FASTEST = 4; 69 static final int NO_DATA_NO_CRC = 8; 70 static final int NO_DATA = 9; 71 } 72 73 @Override 74 public String toString() { 75 final StringBuilder builder = new StringBuilder(); 76 builder.append("LocalFileHeader [archiverVersionNumber="); 77 builder.append(archiverVersionNumber); 78 builder.append(", minVersionToExtract="); 79 builder.append(minVersionToExtract); 80 builder.append(", hostOS="); 81 builder.append(hostOS); 82 builder.append(", arjFlags="); 83 builder.append(arjFlags); 84 builder.append(", method="); 85 builder.append(method); 86 builder.append(", fileType="); 87 builder.append(fileType); 88 builder.append(", reserved="); 89 builder.append(reserved); 90 builder.append(", dateTimeModified="); 91 builder.append(dateTimeModified); 92 builder.append(", compressedSize="); 93 builder.append(compressedSize); 94 builder.append(", originalSize="); 95 builder.append(originalSize); 96 builder.append(", originalCrc32="); 97 builder.append(originalCrc32); 98 builder.append(", fileSpecPosition="); 99 builder.append(fileSpecPosition); 100 builder.append(", fileAccessMode="); 101 builder.append(fileAccessMode); 102 builder.append(", firstChapter="); 103 builder.append(firstChapter); 104 builder.append(", lastChapter="); 105 builder.append(lastChapter); 106 builder.append(", extendedFilePosition="); 107 builder.append(extendedFilePosition); 108 builder.append(", dateTimeAccessed="); 109 builder.append(dateTimeAccessed); 110 builder.append(", dateTimeCreated="); 111 builder.append(dateTimeCreated); 112 builder.append(", originalSizeEvenForVolumes="); 113 builder.append(originalSizeEvenForVolumes); 114 builder.append(", name="); 115 builder.append(name); 116 builder.append(", comment="); 117 builder.append(comment); 118 builder.append(", extendedHeaders="); 119 builder.append(Arrays.toString(extendedHeaders)); 120 builder.append("]"); 121 return builder.toString(); 122 } 123 } 124