Package java.io

Examples of java.io.File.canRead()


  }
 
  public DefaultSettings() {
    mProperties = new Properties();
    File settingsFile = new File(FILENAME);
    if (settingsFile.canRead() && !TVBrowser.isTransportable()) {
      StreamUtilities.inputStreamIgnoringExceptions(settingsFile,
          new InputStreamProcessor() {

            @Override
            public void process(InputStream input) throws IOException {
View Full Code Here


   */
  private void readSearchFormSettings() {
    try {
      String home = Plugin.getPluginManager().getTvBrowserSettings().getTvBrowserUserHome();
      File settingsFile = new File(home,SETTINGS_FILE);
      if (!settingsFile.canRead()) {
        createDefaultSearchFormSettings();
        return;
      }
      StreamUtilities.objectInputStream(settingsFile,
          new ObjectInputStreamProcessor() {
View Full Code Here

        }
        else if (data instanceof String) {
          String name = ((String) data).trim();
          if (name.toLowerCase().endsWith("jar")) {
            File pluginFile = new File(name);
            if (pluginFile.canRead()) {
              addPluginFile(pluginFile, files);
              if (!files.isEmpty()) {
                break;
              }
            }
View Full Code Here

    final ArrayList<ProgramFilter> filterArr = new ArrayList<ProgramFilter>();

    /* Sort the list*/
    try {
      File filterFile = new File(mFilterDirectory, FILTER_INDEX);
      if (filterFile.canRead()) {
        StreamUtilities.bufferedReader(filterFile,
          new BufferedReaderProcessor() {
            public void process(BufferedReader inxIn) throws IOException {
              String curFilterName = inxIn.readLine();
              while (curFilterName != null) {
View Full Code Here

        return super.close();
    }

    boolean loadLayout() throws IOException {
        File file = getLayoutFile();
        if (file != null && file.canRead()) {
            Assert.isTrue(SwingUtilities.isEventDispatchThread());
            Assert.isTrue(rootComponent.isVisible());

            FileInputStream inputStream = new FileInputStream(file);
View Full Code Here

        PdfIndirectReference refFileLength;
        try {
            refFileLength = writer.getPdfIndirectReference();
            if (fileStore == null) {
                File file = new File(filePath);
                if (file.canRead()) {
                    in = new FileInputStream(filePath);
                }
                else {
                    if (filePath.startsWith("file:/") || filePath.startsWith("http://") || filePath.startsWith("https://") || filePath.startsWith("jar:")) {
                        in = new URL(filePath).openStream();
View Full Code Here

            final String msg = CorePlugin.Util.getString("FileUtils.Unable_to_write_file_in", dirPath); //$NON-NLS-1$           
            throw new TeiidException(msg);
        }

        //test if file can be read
        if (!tmpFile.canRead()) {
            final String msg = CorePlugin.Util.getString("FileUtils.Unable_to_read_file_in", dirPath); //$NON-NLS-1$           
            throw new TeiidException(msg);
        }

        //test if file can be renamed
View Full Code Here

   
    for ( String s: locations ){
     
      File f = new File( s, name );
     
      if ( f.exists() && f.canRead()){
       
        return( f.getAbsolutePath());
      }
    }
   
View Full Code Here

    String name )
  {
    final String[] locations = { "/bin", "/usr/bin" };
    for ( String s: locations ){
        File f = new File( s, name );
        if ( f.exists() && f.canRead()){
            return( f.getAbsolutePath());
        }
    }
    return( name );
  }
View Full Code Here

    if ( canonical_file.isDirectory()){

      return( false );
    }

    if ( canonical_file.canRead()){

      String str = canonical_file.toString().toLowerCase();

      int  pos = str.lastIndexOf( "." );
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.