「JAVA海量修改」java海量数据处理
本篇文章给大家谈谈JAVA海量修改,以及java海量数据处理对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
- 1、如何用java对mysql 里面的数据进行批量修改
- 2、java怎样按规定批量修改文件名
- 3、如何进行java海量数据处理,下面一段是我摘抄的问题及处理方法
- 4、用java线程实现批量修改文件名
- 5、java 如何批量修改一张表里面多条数据的某个字段的值,需要修改的字段值是自定义的。
如何用java对mysql 里面的数据进行批量修改
innodb_data_home_dir = /longxibendi/mysql/mysql/var/
#innodb_data_file_path = ibdata1:1G:autoextend
innodb_data_file_path = ibdata1:500M;ibdata2:2210M:autoextend #表空间
innodb_file_io_threads = 4 #io线程数
java怎样按规定批量修改文件名
java批量修改文件名:
public static void main(String[] args) {
updateFileNames("D:\\jjjj", "第");
}
public static void updateFileNames(String url, String index){
File file = new File(url);
//判断文件目录是否存在,且是文件目录,非文件
if(file.exists() file.isDirectory()){
File[] childFiles = file.listFiles();
String path = file.getAbsolutePath();
for(File childFile : childFiles){
//如果是文件
if(childFile.isFile()){
String oldName = childFile.getName();
String newName = oldName.substring(oldName.indexOf(index));
childFile.renameTo(new File(path + "\\" + newName));
}
}
}
}
如何进行java海量数据处理,下面一段是我摘抄的问题及处理方法
lz没理解第二步“分而治之”的思想,分治算法是将一个大问题分解为一系列与大问题性质相同的子问题,所以在分治时不可能把相同的ip分配到不同的文件中,就像你所说的,“按照IP地址的Hash(IP)%1024值,把海量IP日志分别存储到1024个小文件中”,通过hash,两个相同的ip肯定放到同一个文件中了哈
用java线程实现批量修改文件名
; /** * this program TODO * @version * @ausor widjan wu */ package file; import java io File; import java util ArrayList; import java util Scanner; import ncurrent *; public class ChangeFileName { public static void main(String[] args) { Scanner in = new Scanner(System in) System out print( Enter base directory : ) String directory = in nextLine() System out print( Enter key words: ) String keywords = in nextLine() ExecutorService pool = Executors newCachedThreadPool() ChangeName change = new ChangeName(new File(directory) keywords pool) FutureInteger result = pool submit(change) try { System out println(result get() + files were changed ) } catch (ExecutionException e) { e printStackTrace() } catch (InterruptedException e) { } pool shutdown() int largestPoolSize = ((ThreadPoolExecutor) pool) getLargestPoolSize() System out println( largest pool size : + largestPoolSize) } } class ChangeName implements CallableInteger { public ChangeName(File directory String keywords ExecutorService pool) { this directory = directory; this pool = pool; this keywords = keywords; } public Integer call() { count = ; try { File[] files = directory listFiles() ArrayListFutureInteger》 results = new ArrayListFutureInteger》() for (File file : files) { if (file isDirectory()) { ChangeName change = new ChangeName(file keywords pool) FutureInteger result = pool submit(change) } else { count++; String path = file getPath() int index = path lastIndexOf( \\ ) path = path substring( index + ) System out println(path) String oldName = file getName() String fileType = oldName substring(oldName lastIndexOf( )) String newFName = path + keywords + count + fileType; file renameTo(new File(newFName)) } } for(FutureInteger result:results) { try { count +=result get() }catch(ExecutionException e) { e printStackTrace() } } }catch(InterruptedException e) { } return count; } private File directory; private String keywords; private ExecutorService pool; private int count; } lishixinzhi/Article/program/Java/gj/201311/27511
java 如何批量修改一张表里面多条数据的某个字段的值,需要修改的字段值是自定义的。
直接数据库操作嘛 全部改一样的就用update dealers set buynum where 。。
不一样的话就存储结构吧。
用java更新 最好用批处理PreparedStatement stamt.. "update ??????"
for(){ stamt.addBatch(); }
stamt.executeBatch();
关于JAVA海量修改和java海量数据处理的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。
发布于:2022-12-29,除非注明,否则均为
原创文章,转载请注明出处。