@@ -36,12 +36,12 @@ public enum FileSystem {
3636 /**
3737 * Generic file system.
3838 */
39- GENERIC (false , false , Integer .MAX_VALUE , Integer .MAX_VALUE , new int [] { 0 }, new String [] {}, false , false , '/' ),
39+ GENERIC (4096 , false , false , Integer .MAX_VALUE , Integer .MAX_VALUE , new int [] { 0 }, new String [] {}, false , false , '/' ),
4040
4141 /**
4242 * Linux file system.
4343 */
44- LINUX (true , true , 255 , 4096 , new int [] {
44+ LINUX (8192 , true , true , 255 , 4096 , new int [] {
4545 // KEEP THIS ARRAY SORTED!
4646 // @formatter:off
4747 // ASCII NUL
@@ -53,7 +53,7 @@ public enum FileSystem {
5353 /**
5454 * MacOS file system.
5555 */
56- MAC_OSX (true , true , 255 , 1024 , new int [] {
56+ MAC_OSX (4096 , true , true , 255 , 1024 , new int [] {
5757 // KEEP THIS ARRAY SORTED!
5858 // @formatter:off
5959 // ASCII NUL
@@ -76,8 +76,9 @@ public enum FileSystem {
7676 * @see <a href="https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea#consoles">
7777 * CreateFileA function - Consoles (microsoft.com)</a>
7878 */
79- WINDOWS (false , true , 255 ,
80- 32000 , new int [] {
79+ WINDOWS (4096 , false , true ,
80+ 255 , 32000 , // KEEP THIS ARRAY SORTED!
81+ new int [] {
8182 // KEEP THIS ARRAY SORTED!
8283 // @formatter:off
8384 // ASCII NUL
@@ -87,9 +88,8 @@ public enum FileSystem {
8788 29 , 30 , 31 ,
8889 '"' , '*' , '/' , ':' , '<' , '>' , '?' , '\\' , '|'
8990 // @formatter:on
90- }, // KEEP THIS ARRAY SORTED!
91- new String [] { "AUX" , "COM1" , "COM2" , "COM3" , "COM4" , "COM5" , "COM6" , "COM7" , "COM8" , "COM9" , "CON" , "CONIN$" , "CONOUT$" ,
92- "LPT1" , "LPT2" , "LPT3" , "LPT4" , "LPT5" , "LPT6" , "LPT7" , "LPT8" , "LPT9" , "NUL" , "PRN" }, true , true , '\\' );
91+ }, new String [] { "AUX" , "COM1" , "COM2" , "COM3" , "COM4" , "COM5" , "COM6" , "COM7" , "COM8" , "COM9" , "CON" , "CONIN$" , "CONOUT$" ,
92+ "LPT1" , "LPT2" , "LPT3" , "LPT4" , "LPT5" , "LPT6" , "LPT7" , "LPT8" , "LPT9" , "NUL" , "PRN" }, true , true , '\\' );
9393
9494 /**
9595 * <p>
@@ -296,6 +296,8 @@ private static boolean isOsNameMatch(final String osName, final String osNamePre
296296 private static String replace (final String path , final char oldChar , final char newChar ) {
297297 return path == null ? null : path .replace (oldChar , newChar );
298298 }
299+
300+ private final int blockSize ;
299301 private final boolean casePreserving ;
300302 private final boolean caseSensitive ;
301303 private final int [] illegalFileNameChars ;
@@ -305,12 +307,12 @@ private static String replace(final String path, final char oldChar, final char
305307 private final boolean reservedFileNamesExtensions ;
306308 private final boolean supportsDriveLetter ;
307309 private final char nameSeparator ;
308-
309310 private final char nameSeparatorOther ;
310311
311312 /**
312313 * Constructs a new instance.
313314 *
315+ * @param blockSize file allocation block size in bytes.
314316 * @param caseSensitive Whether this file system is case-sensitive.
315317 * @param casePreserving Whether this file system is case-preserving.
316318 * @param maxFileLength The maximum length for file names. The file name does not include folders.
@@ -321,9 +323,10 @@ private static String replace(final String path, final char oldChar, final char
321323 * @param supportsDriveLetter Whether this file system support driver letters.
322324 * @param nameSeparator The name separator, '\\' on Windows, '/' on Linux.
323325 */
324- FileSystem (final boolean caseSensitive , final boolean casePreserving , final int maxFileLength ,
325- final int maxPathLength , final int [] illegalFileNameChars , final String [] reservedFileNames ,
326- final boolean reservedFileNamesExtensions , final boolean supportsDriveLetter , final char nameSeparator ) {
326+ FileSystem (final int blockSize , final boolean caseSensitive , final boolean casePreserving ,
327+ final int maxFileLength , final int maxPathLength , final int [] illegalFileNameChars ,
328+ final String [] reservedFileNames , final boolean reservedFileNamesExtensions , final boolean supportsDriveLetter , final char nameSeparator ) {
329+ this .blockSize = blockSize ;
327330 this .maxFileNameLength = maxFileLength ;
328331 this .maxPathLength = maxPathLength ;
329332 this .illegalFileNameChars = Objects .requireNonNull (illegalFileNameChars , "illegalFileNameChars" );
@@ -336,6 +339,16 @@ private static String replace(final String path, final char oldChar, final char
336339 this .nameSeparatorOther = FilenameUtils .flipSeparator (nameSeparator );
337340 }
338341
342+ /**
343+ * Gets the file allocation block size in bytes.
344+ * @return the file allocation block size in bytes.
345+ *
346+ * @since 2.12.0
347+ */
348+ public int getBlockSize () {
349+ return blockSize ;
350+ }
351+
339352 /**
340353 * Gets a cloned copy of the illegal characters for this file system.
341354 *
0 commit comments