Java tutorial
/** * Copyright 2014, 2015, 2016, 2017 TAIN, Inc. all rights reserved. * * Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007 (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.gnu.org/licenses/ * * 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. * * ----------------------------------------------------------------- * Copyright 2014, 2015, 2016, 2017 TAIN, Inc. * */ package tain.kr.test.vfs.v01; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.VFS; import org.apache.log4j.Logger; /** * Code Templates > Comments > Types * * <PRE> * -. FileName : ChangeLastModificationTime.java * -. Package : tain.kr.test.vfs.v01 * -. Comment : * -. Author : taincokr * -. First Date : 2017. 4. 12. {time} * </PRE> * * @author taincokr * */ public final class ChangeLastModificationTime { private static boolean flag = true; private static final Logger log = Logger.getLogger(ChangeLastModificationTime.class); /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// /* * constructor */ public ChangeLastModificationTime() { if (flag) log.debug(">>>>> in class " + this.getClass().getSimpleName()); } /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// /* * static test method */ private static void test01(String[] args) throws Exception { if (flag) new ChangeLastModificationTime(); if (flag) { if (args.length == 0) { System.err.println("Please pass the name of a file as parameter."); return; } final FileObject fo = VFS.getManager().resolveFile(args[0]); final long setTo = System.currentTimeMillis(); System.err.println("set to: " + setTo); fo.getContent().setLastModifiedTime(setTo); System.err.println("after set: " + fo.getContent().getLastModifiedTime()); } } /* * main method */ public static void main(String[] args) throws Exception { if (flag) log.debug(">>>>> " + new Object() { }.getClass().getEnclosingClass().getName()); args = new String[] { "N:/tain/test" }; if (flag) test01(args); } }