Package java.io

Examples of java.io.File.canRead()


      if (file.exists()) {
         if (file.isDirectory()) {
            log.warning("findFileInSinglePath: the given name '" + file.getAbsolutePath() + "' is not a file, it is a directory");
            return null;
         }
         if (!file.canRead()) {
            log.warning("findFileInSinglePath: don't have the rights to read the file '" + file.getAbsolutePath() + "'");
            return null;
         }
         try {
            return file.toURL();
View Full Code Here


    // Determine the mime-type
    String mimeType;
    try {
      File file = rawDocument.getContentAsFile();
      if (file.canRead() == false) {
        mLog.warn("canRead() on file return: false. Maybe no access rights for sourceURL: " +
          RegainToolkit.fileToUrl(file));
        return null;
      }
View Full Code Here

      if (url.startsWith("file://")) {
        // file system: Check whether this is a directory
        try {
          File file = RegainToolkit.urlToFile(url);
          // Check whether the file is readable.
          if (!file.canRead()) {
            mCrawlerJobProfiler.abortMeasuring();
            mLog.debug("File rights: canRead: " + file.canRead() +
                    " canExecute: " + file.canExecute() +
                    " canWrite: " + file.canWrite() + " exists: " + file.exists() +
                    " for url: " + url + ", canonical url: " + file.getCanonicalPath());
View Full Code Here

        try {
          File file = RegainToolkit.urlToFile(url);
          // Check whether the file is readable.
          if (!file.canRead()) {
            mCrawlerJobProfiler.abortMeasuring();
            mLog.debug("File rights: canRead: " + file.canRead() +
                    " canExecute: " + file.canExecute() +
                    " canWrite: " + file.canWrite() + " exists: " + file.exists() +
                    " for url: " + url + ", canonical url: " + file.getCanonicalPath());
            logError("File is not readable: '" + url + "'", null, false);
            continue;
View Full Code Here

  static void make(DiskCache2 dc, String filename) throws IOException {
    File want = dc.getCacheFile(filename);
    System.out.println("make=" + want.getPath() + "; exists = " + want.exists());
    if (!want.exists())
      want.createNewFile();
    System.out.println(" canRead= " + want.canRead() + " canWrite = " + want.canWrite() + " lastMod = " + new Date(want.lastModified()));

    String enc = EscapeStrings.urlEncode(filename);
    System.out.println(" original=" + EscapeStrings.urlDecode(enc));
    /* try {
      String enc = java.net.URLEncoder.encode(filename, "UTF8");
View Full Code Here

    if ( ! sourceDataFile.exists() )
    {
      fail( "Non-existent source data file [" + sourceDataFile.getPath() + "].");
      return false;
    }
    if ( ! sourceDataFile.canRead() )
    {
      fail( "Cannot read source data file [" + sourceDataFile.getPath() + "]." );
      return false;
    }
View Full Code Here

    if ( ! sourceDataFile.exists())
    {
      fail( "Non-existent source data file [" + sourceDataFile.getPath() + "].");
      return false;
    }
    if ( ! sourceDataFile.canRead() )
    {
      fail( "Cannot read data file [" + sourceDataFile.getPath() + "]." );
      return false;
    }
View Full Code Here

    if ( ! sourceDataFile.exists())
    {
      fail( "Non-existent source GRIB file [" + sourceDataFile.getPath() + "].");
      return false;
    }
    if ( ! sourceDataFile.canRead())
    {
      fail( "Cannot read the source GRIB file [" + sourceDataFile.getPath() + "].");
      return false;
    }
View Full Code Here

    if ( ! indexFileSource.exists() )
    {
      fail( "Non-existent source index file [" + indexFileSource + "]." );
      return false;
    }
    if ( ! indexFileSource.canRead() )
    {
      fail( "Cannot read source index file [" + indexFileSource.getPath() + "]." );
      return false;
    }
View Full Code Here

          throws IOException, InvalidRangeException
  {
    File testDataDir = new File( TestAll.cdmLocalTestDataDir, "ucar/nc2/iosp/netcdf3" );
    File testFile = new File( testDataDir, "byteArrayRecordVarPaddingTest-bad.nc" );
    assertTrue( testFile.exists());
    assertTrue( testFile.canRead());

    NetcdfFile ncf = NetcdfFile.open( testFile.getPath() );
    Variable readVar = ncf.findVariable( "V" );
    assertEquals( readVar.getDataType(), DataType.BYTE );
    assertEquals( 1, readVar.getElementSize() );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.