Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F4156200D3A for ; Wed, 15 Nov 2017 18:33:40 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id F290B160BF4; Wed, 15 Nov 2017 17:33:40 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4460F160BE4 for ; Wed, 15 Nov 2017 18:33:40 +0100 (CET) Received: (qmail 69981 invoked by uid 500); 15 Nov 2017 17:33:39 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 69969 invoked by uid 99); 15 Nov 2017 17:33:39 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Nov 2017 17:33:38 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 38459C3E44 for ; Wed, 15 Nov 2017 17:33:38 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.879 X-Spam-Level: * X-Spam-Status: No, score=1.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id tiTOEshq3H6x for ; Wed, 15 Nov 2017 17:33:37 +0000 (UTC) Received: from mail-oi0-f54.google.com (mail-oi0-f54.google.com [209.85.218.54]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 127305F6C8 for ; Wed, 15 Nov 2017 17:33:37 +0000 (UTC) Received: by mail-oi0-f54.google.com with SMTP id y206so15286164oiy.4 for ; Wed, 15 Nov 2017 09:33:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=LrTa0Q94BFXgnI0qk8PydV7OZF7ymMC8fm+ZEP8CNsQ=; b=XBWjqo1fxbmeKrrQWteMWEaq5eY1VLGU9N5QndktSSPkk353zjpCtHyPghlFlPI9mM /wkrnLl+i9PIMHyF+DHNqQPELigWyT+xp/SHzy6vxZ6Jbzma5MSXAZp1vlzFa0c5dm3M ZWe9QCsQNXBv7N3ESu4Hd3Ya3HGzDErsABAbM4Hxa5NFwAlMJvo0jI97eDCj/yTp6qE0 rUrrieCn5w0ux7PLEEitExaWsgy3564tAxQJLAmLAoaQrgzWSRckZz6wQCDT8zAMUuqY TQuNEDcn0fnffk3jVogGiaBwUmV6iQSj2eqXTKK6lA2P0tuTQFVIuUySUUFUqoBn7Eho 3z6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=LrTa0Q94BFXgnI0qk8PydV7OZF7ymMC8fm+ZEP8CNsQ=; b=Xpx2Zvy8jK+NQr0U/ASb6qrzQmbFnFZe3qu04diHUzoHhxhSHGO7c1n//B2dHsGuVo k3q5Vl9c6x2nLPVhub7hx/5PPuixREJ8yZtohFhbYqixjYzuV7YFuHw+IkQ3lrwu5Hd4 Svz8xeZ3/HEwdDepJb/WOMrisq1ZODltbcm23PzspdDUpw9pZLftYSaK1RPrvdS80lgE /louIgrIpnL4DUbq6/9M9nX0/AZ9gY/11LJeuCJo7RtDH0GUNrEqasXlvA6yUssCBirt V2kxjAaObrBu4bbXvm3r/C8xIphJo+NuJUNQasC4ksS8Jvw6Bviu4sw+660jkveo0WzL bzLQ== X-Gm-Message-State: AJaThX4zDr2nxu9/1Kne63u3p55nQ4PAJUgCiRFBO/+g2MKRw8b6U85b DcSYhvc5hJJboW4EMFDficXK3PSgBRJjQrHit9JmbVQ= X-Google-Smtp-Source: AGs4zMZUep2q60M2J04m7MnsNpJXRVsmeYoJT7Ce8SSBhqTqqKiRtKTDBmDpmIRaPSM+DLu2m40wrt2/9ot/2LQMMOc= X-Received: by 10.202.193.87 with SMTP id r84mr9081236oif.29.1510767216286; Wed, 15 Nov 2017 09:33:36 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.0.198 with HTTP; Wed, 15 Nov 2017 09:33:35 -0800 (PST) In-Reply-To: References: From: Gary Gregory Date: Wed, 15 Nov 2017 10:33:35 -0700 Message-ID: Subject: Re: [io] New enum for file system info? To: Commons Developers List Content-Type: multipart/alternative; boundary="001a113dc79643e300055e08e7ca" archived-at: Wed, 15 Nov 2017 17:33:41 -0000 --001a113dc79643e300055e08e7ca Content-Type: text/plain; charset="UTF-8" On Wed, Nov 15, 2017 at 10:30 AM, Gary Gregory wrote: > I find myself writing and using non-OO code around things like: > > private final int MAX_FILE_NAME_LENGTH_WINDOWS = 255; > private final int MAX_FILE_NAME_LENGTH_LINUX = 255; > private final int MAX_FILE_NAME_LENGTH_MAC = 255; > private final int MAX_FILE_NAME_LENGTH_MAC_OS9 = 31; > > private final int MAX_FILE_PATH_LENGTH_WINDOWS = 32000; > private final int MAX_FILE_PATH_LENGTH_LINUX = 4096; > private final int MAX_FILE_PATH_LENGTH_MAC = 1024; > > But that is not even right for older Macs which limits file names to 31 > chars. > > I was thinking of creating a new enum: > > package org.apache.commons.io; > > public enum FileSystem { > > LINUX(255, 4096), > MAC_OSX(255, 1024), > MAC_OSX_9(31, 1024), > WINDOWS(255, 32000); > > private final long maxFileLength; > private final long maxPathLength; > > private FileSystem(long maxFileLength, long maxPathLength) { > this.maxFileLength = maxFileLength; > this.maxPathLength = maxPathLength; > } > > public long getMaxFileLength() { > return maxFileLength; > } > > public long getMaxPathLength() { > return maxPathLength; > } > > public boolean isIllegalFileName(char ch) { > ... > } > > public String toLegalFileName(String candidate, char replacement) { > ... > } > > } > > I would also move the new method from https://issues.apache.org/ > jira/browse/IO-555 there and rename it "isIllegalFileName(char)" > > Thoughts? > The enum would obviously need a "public static FileSystem getCurrent()" method. Gary > > Gary > --001a113dc79643e300055e08e7ca--