Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2014 Philip Helger (www.helger.com) philip[at]helger[dot]com 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 com.helger.appbasics.app.dao.impl;
 
 import java.io.File;
 
 
 
 public class DAOWebFileIO implements IDAOIO
 {
   private static final DAOWebFileIO s_aInstance = new DAOWebFileIO ();
 
   protected DAOWebFileIO ()
   {}
 
   @Nonnull
   public static DAOWebFileIO getInstance ()
   {
     return ;
   }
 
   @Nonnull
   public PathRelativeFileIO getFileIO ()
   {
     return WebFileIO.getDataIO ();
   }
 
   @Nonnull
   {
     return WebFileIO.getFileOpMgr ();
   }

  

Returns:
Overwrite this only if you know what you're doing.
 
   @Nullable
   public InputStream openInputStream (@Nullable final String sFilename)
   {
     // we're not operating on a file!
     if (sFilename == null)
       return null;
 
     return getFileIO ().getInputStream (sFilename);
   }
 
   @Nonnull
   public IReadableResource getReadableResource (@Nonnull final String sFilename)
   {
     return getFileIO ().getResource (sFilename);
   }
 
   public void renameFile (@Nonnull final String sSrcFileName, @Nonnull final String sDstFileName)
   {
     final PathRelativeFileIO aIO = getFileIO ();
     final File aSrcFile = aIO.getFile (sSrcFileName);
     if (FileUtils.existsFile (aSrcFile))
     {
       final File aDstFile = aIO.getFile (sDstFileName);
 
       // Delete destination file if present
       final FileOperationManager aFileOpMgr = getFileOperationMgr ();
       if (aFileOpMgr.deleteFileIfExisting (aDstFile).isSuccess ())
       {
         // and rename existing file to backup file
         aFileOpMgr.renameFile (aSrcFileaDstFile);
       }
     }
   }
 
   @Nonnull
  public ESuccess saveFile (@Nonnull final String sFilename,
                            @Nonnull final String sContent,
                            @Nonnull final Charset aCharset)
  {
    return getFileIO ().saveFile (sFilenamesContentaCharset);
  }
  public String toString ()
  {
    return new ToStringGenerator (this).toString ();
  }
New to GrepCode? Check out our FAQ X