congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Files.write
Code IndexAdd Tabnine to your IDE (free)

How to use
write
method
in
org.nutz.lang.Files

Best Java code snippets using org.nutz.lang.Files.write (Showing top 20 results out of 315)

origin: nutzam/nutz

public void truncate(long len) throws SQLException {
  Files.write(file, new Byte[]{});
}
origin: nutzam/nutz

  public Class<?> define(String className, byte[] bytes, ClassLoader loader) {
    try {
      if (debugDir != null)
        Files.write(debugDir + className.replace('.', '/') + ".class", bytes);
      return ReflectTool.defineClass(className, bytes, loader);
    }
    catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}
origin: nutzam/nutz

public static boolean copyOnWrite(File f, Object obj) {
  File tmp = new File(f.getAbsolutePath() + ".new");
  File tmp2 = new File(f.getAbsolutePath() + ".old");
  tmp2.delete();
  try {
    write(tmp, obj);
    boolean flag = false;
    if (f.exists()) {
      flag = f.renameTo(tmp2);
    }
    if (tmp.renameTo(f)) {
      tmp2.delete();
      return true;
    } else if (flag)
      tmp2.renameTo(f); // 如果这里也失败的话,起码.old还在...
    return false;
  }
  finally {
    tmp.delete();
  }
}
origin: nutzam/nutz

public Object get(ResultSet rs, int columnIndex) throws SQLException {
  Blob blob = rs.getBlob(columnIndex);
  if (blob == null)
    return null;
  File f = this.createTempFile();
  Files.write(f, blob.getBinaryStream());
  return new SimpleBlob(f);
}
origin: nutzam/nutz

public Object get(ResultSet rs, String colName) throws SQLException {
  Blob blob = rs.getBlob(colName);
  if (blob == null)
    return null;
  File f = this.createTempFile();
  Files.write(f, blob.getBinaryStream());
  return new SimpleBlob(f);
}
origin: nutzam/nutz

public Object get(ResultSet rs, String colName) throws SQLException {
  InputStream in = rs.getBinaryStream(colName);
  if (in == null) {
    return in;
  }
  try {
    File f = File.createTempFile("nutzdao_blob", ".tmp");
    Files.write(f, in);
    in.close();
    return new ReadOnceInputStream(f);
  }
  catch (IOException e) {
    throw Lang.wrapThrow(e);
  }
}
origin: nutzam/nutz

@Override
public Object get(ResultSet rs, String colName) throws SQLException {
  InputStream ins = rs.getBinaryStream(colName);
  if (ins == null)
    return null;
  File f = this.createTempFile();
  Files.write(f, ins);
  return new SimpleBlob(f);
}
origin: nutzam/nutz

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException{
    f = Jdbcs.getFilePool().createFile(".dat");
    Files.write(f, in);
  }
}
origin: nutzam/nutz

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException{
    file = Jdbcs.getFilePool().createFile(".clob");
    Files.write(file, in);
  }
}
origin: nutzam/nutz

private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException{
  file = Jdbcs.getFilePool().createFile(".blob");
  Files.write(file, in);
}

origin: nutzam/nutz

/**
 * 将内容写到一个文件内,内容对象可以是:
 * <ul>
 * <li>InputStream - 按二进制方式写入
 * <li>byte[] - 按二进制方式写入
 * <li>Reader - 按 UTF-8 方式写入
 * <li>其他对象被 toString() 后按照 UTF-8 方式写入
 * </ul>
 * 
 * @param path
 *            文件路径,如果不存在,则创建
 * @param obj
 *            内容对象
 */
public static void write(String path, Object obj) {
  if (null == path || null == obj)
    return;
  try {
    write(Files.createFileIfNoExists(path), obj);
  }
  catch (IOException e) {
    throw Lang.wrapThrow(e);
  }
}
origin: nutzam/nutz

Files.write(tmp, img);
try {
  return read(tmp);
origin: org.nutz/nutz

  public Class<?> define(String className, byte[] bytes, ClassLoader loader) {
    try {
      if (debugDir != null)
        Files.write(debugDir + className.replace('.', '/') + ".class", bytes);
      return ReflectTool.defineClass(className, bytes, loader);
    }
    catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}
origin: Rekoe/rk_svnadmin

  public void visit(File file) {
    if (file.isDirectory())
      return;
    System.out.println(file);
    String origin = Files.read(file);
    String output = origin.replaceAll("FZY4JW_0.ttf", "FZY4FZ_0.ttf");
    if (origin.equals(output))
      return;
    Files.write(file, output);
  }
};
origin: org.nutz/nutz

public Object get(ResultSet rs, int columnIndex) throws SQLException {
  Blob blob = rs.getBlob(columnIndex);
  if (blob == null)
    return null;
  File f = this.createTempFile();
  Files.write(f, blob.getBinaryStream());
  return new SimpleBlob(f);
}
origin: org.nutz/nutz

public Object get(ResultSet rs, String colName) throws SQLException {
  Blob blob = rs.getBlob(colName);
  if (blob == null)
    return null;
  File f = this.createTempFile();
  Files.write(f, blob.getBinaryStream());
  return new SimpleBlob(f);
}
origin: org.nutz/nutz

@Override
public Object get(ResultSet rs, String colName) throws SQLException {
  InputStream ins = rs.getBinaryStream(colName);
  if (ins == null)
    return null;
  File f = this.createTempFile();
  Files.write(f, ins);
  return new SimpleBlob(f);
}
origin: org.nutz/nutz

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException{
    f = Jdbcs.getFilePool().createFile(".dat");
    Files.write(f, in);
  }
}
origin: org.nutz/nutz

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException{
    file = Jdbcs.getFilePool().createFile(".clob");
    Files.write(file, in);
  }
}
origin: nutzam/nutz-web

public void reset() {
  try {
    File f = Files.createFileIfNoExists(god_key_file_my);
    key = R.UU64();
    Files.write(f, key + "\r\n");
  }
  catch (IOException e) {
    throw Lang.wrapThrow(e);
  }
}
org.nutz.langFileswrite

Javadoc

将内容写到一个文件内,内容对象可以是:
  • InputStream - 按二进制方式写入
  • byte[] - 按二进制方式写入
  • Reader - 按 UTF-8 方式写入
  • 其他对象被 toString() 后按照 UTF-8 方式写入

Popular methods of Files

  • findFile
    从 CLASSPATH 下或从指定的本机器路径下寻找一个文件
  • createDirIfNoExists
    试图生成一个目录对象,如果文件不存在则创建它。 如果给出的 PATH 是相对路径 则会在 CLASSPATH 中寻找,如果未找到,则会在用户主目录中创建这个目录
  • createFileIfNoExists
    试图生成一个文件对象,如果文件不存在则创建它。 如果给出的 PATH 是相对路径 则会在 CLASSPATH 中寻找,如果未找到,则会在用户主目录中创建这个文件
  • getSuffixName
    获取文件后缀名,不包括 '.',如 'abc.gif',',则返回 'gif'
  • readBytes
    读取文件全部字节,并关闭文件
  • renameSuffix
    将文件路径后缀改名,从而生成一个新的文件路径。
  • cleanAllFolderInSubFolderes
    将一个目录下的特殊名称的目录彻底删除,比如 '.svn' 或者 '.cvs'
  • deleteFile
    删除一个文件
  • findFileAsStream
    获取输出流
  • getName
  • makeDir
    创建新目录,如果父目录不存在,也一并创建。可接受 null 参数
  • read
    读取 UTF-8 文件全部内容
  • makeDir,
  • read,
  • checkFile,
  • clearDir,
  • copy,
  • copyDir,
  • copyFile,
  • copyOnWrite,
  • createNewFile

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setRequestProperty (URLConnection)
  • runOnUiThread (Activity)
  • startActivity (Activity)
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • BoxLayout (javax.swing)
  • JButton (javax.swing)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Github Copilot alternatives
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