Tabnine Logo
IOException.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
java.io.IOException
constructor

Best Java code snippets using java.io.IOException.<init> (Showing top 20 results out of 112,707)

Refine searchRefine arrow

  • TCompactProtocol.<init>
  • TIOStreamTransport.<init>
  • File.<init>
  • File.exists
  • File.mkdirs
  • File.isDirectory
  • File.getAbsolutePath
origin: square/okhttp

@Override public void delete(File file) throws IOException {
 // If delete() fails, make sure it's because the file didn't exist!
 if (!file.delete() && file.exists()) {
  throw new IOException("failed to delete " + file);
 }
}
origin: skylot/jadx

private InputFile(File file) throws IOException {
  if (!file.exists()) {
    throw new IOException("File not found: " + file.getAbsolutePath());
  }
  this.file = file;
}
origin: greenrobot/greenDAO

protected File toFileForceExists(String filename) throws IOException {
  File file = new File(filename);
  if (!file.exists()) {
    throw new IOException(filename
        + " does not exist. This check is to prevent accidental file generation into a wrong path.");
  }
  return file;
}
origin: apache/flink

private static void checkAndCreateDirectory(File directory) throws IOException {
  if (directory.exists()) {
    if (!directory.isDirectory()) {
      throw new IOException("Not a directory: " + directory);
    }
  } else {
    if (!directory.mkdirs()) {
      throw new IOException(
        String.format("Could not create RocksDB data directory at %s.", directory));
    }
  }
}
origin: apache/flink

public static void checkJarFile(URL jar) throws IOException {
  File jarFile;
  try {
    jarFile = new File(jar.toURI());
  } catch (URISyntaxException e) {
    throw new IOException("JAR file path is invalid '" + jar + "'");
  }
  if (!jarFile.exists()) {
    throw new IOException("JAR file does not exist '" + jarFile.getAbsolutePath() + "'");
  }
  if (!jarFile.canRead()) {
    throw new IOException("JAR file can't be read '" + jarFile.getAbsolutePath() + "'");
  }
  // TODO: Check if proper JAR file
}
origin: square/okhttp

public void run() throws Exception {
 File file = new File("README.md");
 Request request = new Request.Builder()
   .url("https://api.github.com/markdown/raw")
   .post(RequestBody.create(MEDIA_TYPE_MARKDOWN, file))
   .build();
 try (Response response = client.newCall(request).execute()) {
  if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
  System.out.println(response.body().string());
 }
}
origin: redisson/redisson

/**
 * Creates single folders.
 */
public static void mkdir(File dir) throws IOException {
  if (dir.exists()) {
    if (!dir.isDirectory()) {
      throw new IOException(MSG_NOT_A_DIRECTORY + dir);
    }
    return;
  }
  if (!dir.mkdir()) {
    throw new IOException(MSG_CANT_CREATE + dir);
  }
}
origin: jenkinsci/jenkins

  @Override
  public String invoke(File dir, VirtualChannel channel) throws IOException {
    if(!inThisDirectory)
      dir = new File(System.getProperty("java.io.tmpdir"));
    else
      mkdirs(dir);
    File f;
    try {
      f = creating(File.createTempFile(prefix, suffix, dir));
    } catch (IOException e) {
      throw new IOException("Failed to create a temporary directory in "+dir,e);
    }
    try (Writer w = new FileWriter(writing(f))) {
      w.write(contents);
    }
    return f.getAbsolutePath();
  }
}
origin: SonarSource/sonarqube

private static void throwExceptionIfDirectoryIsNotCreatable(File to) throws IOException {
 if (!to.exists() && !to.mkdirs()) {
  throw new IOException(ERROR_CREATING_DIRECTORY + to);
 }
}
origin: apache/zeppelin

private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
 try {
  read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
 } catch (org.apache.thrift.TException te) {
  throw new java.io.IOException(te);
 }
}
origin: apache/incubator-dubbo

protected static TProtocol newProtocol(URL url, ChannelBuffer buffer) throws IOException {
  String protocol = url.getParameter(ThriftConstants.THRIFT_PROTOCOL_KEY,
      ThriftConstants.DEFAULT_PROTOCOL);
  if (ThriftConstants.BINARY_THRIFT_PROTOCOL.equals(protocol)) {
    return new TBinaryProtocol(new TIOStreamTransport(new ChannelBufferOutputStream(buffer)));
  }
  throw new IOException("Unsupported protocol type " + protocol);
}
origin: redisson/redisson

/**
 * Creates all folders at once.
 */
public static void mkdirs(File dirs) throws IOException {
  if (dirs.exists()) {
    if (!dirs.isDirectory()) {
      throw new IOException(MSG_NOT_A_DIRECTORY + dirs);
    }
    return;
  }
  if (!dirs.mkdirs()) {
    throw new IOException(MSG_CANT_CREATE + dirs);
  }
}
origin: azkaban/azkaban

private Props loadDBProps() throws IOException {
 final File dbPropsFile = new File(this.scriptPath, "database.properties");
 if (!dbPropsFile.exists()) {
  throw new IOException(
    "Cannot find 'database.properties' file in " + dbPropsFile.getAbsolutePath());
 }
 return new Props(null, dbPropsFile);
}
origin: stackoverflow.com

 // File (or directory) with old name
File file = new File("oldname");

// File (or directory) with new name
File file2 = new File("newname");

if (file2.exists())
  throw new java.io.IOException("file exists");

// Rename file (or directory)
boolean success = file.renameTo(file2);

if (!success) {
  // File was not successfully renamed
}
origin: jenkinsci/jenkins

  @Override
  public void visitSymlink(File link, String target, String relativePath) throws IOException {
    try {
      mkdirsE(new File(dest, relativePath).getParentFile());
      writing(new File(dest, target));
      Util.createSymlink(dest, target, relativePath, TaskListener.NULL);
    } catch (InterruptedException x) {
      throw new IOException(x);
    }
    count.incrementAndGet();
  }
}));
origin: Tencent/tinker

public void setSignData(File signatureFile, String keypass, String storealias, String storepass) throws IOException {
  if (mUseSignAPk) {
    mSignatureFile = signatureFile;
    if (!mSignatureFile.exists()) {
      throw new IOException(
        String.format("the signature file do not exit, raw path= %s\n", mSignatureFile.getAbsolutePath())
      );
    }
    mKeyPass = keypass;
    mStoreAlias = storealias;
    mStorePass = storepass;
  }
}
origin: redisson/redisson

private static void checkDirCopy(File srcDir, File destDir) throws IOException {
  if (!srcDir.exists()) {
    throw new FileNotFoundException(MSG_NOT_FOUND + srcDir);
  }
  if (!srcDir.isDirectory()) {
    throw new IOException(MSG_NOT_A_DIRECTORY + srcDir);
  }
  if (equals(srcDir, destDir)) {
    throw new IOException("Source '" + srcDir + "' and destination '" + destDir + "' are equal");
  }
}
origin: prestodb/presto

@Override public void delete(File file) throws IOException {
 // If delete() fails, make sure it's because the file didn't exist!
 if (!file.delete() && file.exists()) {
  throw new IOException("failed to delete " + file);
 }
}
origin: jenkinsci/jenkins

    @Override
    public Void invoke(File f, VirtualChannel channel) throws IOException {
      // JENKINS-16846: if f.getName() is the same as one of the files/directories in f,
      // then the rename op will fail
      File tmp = new File(f.getAbsolutePath()+".__rename");
      if (!f.renameTo(tmp))
        throw new IOException("Failed to rename "+f+" to "+tmp);
      File t = new File(target.getRemote());
      for(File child : reading(tmp).listFiles()) {
        File target = new File(t, child.getName());
        if(!stating(child).renameTo(creating(target)))
          throw new IOException("Failed to rename "+child+" to "+target);
      }
      deleting(tmp).delete();
      return null;
    }
}
origin: neo4j/neo4j

@Override
public void mkdirs( File path ) throws IOException
{
  if ( path.exists() )
  {
    return;
  }
  path.mkdirs();
  if ( path.exists() )
  {
    return;
  }
  throw new IOException( format( UNABLE_TO_CREATE_DIRECTORY_FORMAT, path ) );
}
java.ioIOException<init>

Javadoc

Constructs a new IOException with its stack trace filled in.

Popular methods of IOException

  • getMessage
  • printStackTrace
  • toString
  • initCause
  • getLocalizedMessage
  • getCause
  • getStackTrace
  • addSuppressed
  • setStackTrace
  • fillInStackTrace
  • getSuppressed
  • getSuppressed

Popular in Java

  • Updating database using SQL prepared statement
  • runOnUiThread (Activity)
  • compareTo (BigDecimal)
  • putExtra (Intent)
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • JLabel (javax.swing)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now