Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 35617 invoked from network); 17 May 2004 18:30:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 17 May 2004 18:30:51 -0000 Received: (qmail 64540 invoked by uid 500); 17 May 2004 18:31:08 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 64379 invoked by uid 500); 17 May 2004 18:31:07 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 64363 invoked by uid 500); 17 May 2004 18:31:07 -0000 Received: (qmail 64351 invoked by uid 98); 17 May 2004 18:31:07 -0000 Received: from imario@apache.org by hermes.apache.org by uid 82 with qmail-scanner-1.20 (clamuko: 0.70. Clear:RC:0(209.237.227.194):. Processed in 0.043825 secs); 17 May 2004 18:31:07 -0000 X-Qmail-Scanner-Mail-From: imario@apache.org via hermes.apache.org X-Qmail-Scanner: 1.20 (Clear:RC:0(209.237.227.194):. Processed in 0.043825 secs) Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by hermes.apache.org with SMTP; 17 May 2004 18:31:07 -0000 Received: (qmail 35571 invoked by uid 1850); 17 May 2004 18:30:45 -0000 Date: 17 May 2004 18:30:45 -0000 Message-ID: <20040517183045.35570.qmail@minotaur.apache.org> From: imario@apache.org To: jakarta-commons-sandbox-cvs@apache.org Subject: cvs commit: jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/example ShowProperties.java X-Spam-Rating: hermes.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N imario 2004/05/17 11:30:45 Added: vfs/src/java/org/apache/commons/vfs/example ShowProperties.java Log: PR: 29007 Submitted By: Anthony Goubard (adagoubard@chello.nl) Example showing how to resolv Files and prints their filename-components and properties at system.out Revision Changes Path 1.1 jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/example/ShowProperties.java Index: ShowProperties.java =================================================================== /* * Copyright 2003,2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.vfs.example; import org.apache.commons.vfs.FileObject; import org.apache.commons.vfs.FileSystemException; import org.apache.commons.vfs.FileSystemManager; import org.apache.commons.vfs.VFS; /** * A simple that prints the properties of the file passed as first parameter. * * @author Anthony Goubard * @version $Revision: 1.1 $ $Date: 2004/05/17 18:30:45 $ */ public class ShowProperties { public static void main(String[] args) { if (args.length == 0) { System.err.println("Please pass the name of a file as parameter."); System.err.println("e.g. java org.apache.commons.vfs.example.ShowProperties LICENSE.txt"); return; } try { FileSystemManager mgr = VFS.getManager(); FileObject file = mgr.resolveFile(args[0]); System.out.println("file " + file); System.out.println("file.getURL() " + file.getURL()); System.out.println("file.getURL().toExternalForm() " + file.getURL().toExternalForm()); System.out.println("file.getName() " + file.getName()); System.out.println("file.getName().getBaseName() " + file.getName().getBaseName()); System.out.println("file.getName().getExtension() " + file.getName().getExtension()); System.out.println("file.getName().getPath() " + file.getName().getPath()); System.out.println("file.getName().getScheme() " + file.getName().getScheme()); System.out.println("file.getName().getURI() " + file.getName().getURI()); System.out.println("file.getName().getRootURI() " + file.getName().getRootURI()); System.out.println("file.getName().getParent() " + file.getName().getParent()); System.out.println("file.getType() " + file.getType()); System.out.println("file.getFileSystem().getRoot().getName().getPath() " + file.getFileSystem().getRoot().getName().getPath()); } catch (FileSystemException ex) { ex.printStackTrace(); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org