
public static void main(String[] args) throws Exception {
Reader reader=new FileReader("d:/NewFilehtml");
String content="";//每一行
//写入文件
Writer writer=new FileWriter(new File("d:/wanttxt"));
//缓冲流封装一下,读写方便
BufferedWriter bw=new BufferedWriter(writer);
BufferedReader br=new BufferedReader(reader);
while((content=brreadLine())!=null){
if(contenttoLowerCase()indexOf("<script")!=-1&&contenttoLowerCase()contains("src")){
bwwrite(contentsubstring(contentindexOf("src"),contentlastIndexOf("\""))+"\r\n");
}
}
bwclose();
writerclose();
brclose();
readerclose();
}
安卓手机打开srt文件的步骤:找到srt文件在安卓手机中的存放位置。下载软件暴风影音。打开暴风影音,找到srt文件后即可将其打开。srt文件是字幕文件,srt文件可以使用系统自带的文本处理器来打开,也可以使用视频播放软件配合对应视频才能正常打开。以暴风影音APP为例,将字幕文件和同名视频文件放在安卓手机同目录下,使用暴风影音打开该视频即可自动加载字幕文件。比较流行的文本字幕有srt、smi、ssa,因为是文本格式,所以就比较小了,一般大不过百来k。其中srt文本字幕最为流行,因为其制作规范简单,一句时间代码+一句字幕,使得制作修改就相当简单。配合上style文件还能让srt自带一些字体上的特效等。几种文本字幕可以互相转换。文本字幕一般通过对图形字幕进行OCR或者手工制作生成,OCR英文字幕不难,毕竟英文识别难度小嘛,OCR中文难度就大一些,所用的软件个头也不小(SubOCR,30多MB)。
// 直接一个斜杠就可以了
<script type = "" src="/js" />
// 不过获取根目录需要在服务端运行
// 不然假设你这个项目是放在 D盘的N层文件夹里面
// 无论你在哪一层打开文件 根目录都会直接是 D盘
你好,可以采用两种访问方式:
绝对路径
如:D:\workspace\xxx\xx 这种方式访问。
相对路径 我们使用最多的一种方式
在这个项目中,如果你建立一个包(其实是目录),就写你相应的转换成目录即可。
如:在src下建立一个包叫 comcnbaidu 你访问此目录下的文件用以下代码即可:
InputStream in = new BufferedInputStream(new FileInputStream("/com/cn/baidu/setproperties"));packagecomfutureutil;importjavaioFileNotFoundException;importjavaioIOException;importjavaioInputStream;importjavautilProperties;/读取资源配置文件@authorcoder/@SuppressWarnings("serial")publicclassCommonPropertiesUtil{@SuppressWarnings("static-access")publicstaticStringgetContextPath(){StringcontextPath="";try{//加载src目录下的文件的几种方式//注意当使用getClass()方式而不是getClassLoader()时资源文件前的"/"不能省略//InputStreamstream=thisgetClass()getResourceAsStream("/commonproperties");//InputStreamstream=ThreadcurrentThread()getClass()getResourceAsStream("/commonproperties");InputStreamstream=ThreadcurrentThread()getContextClassLoader()getResourceAsStream("commonproperties");//谨记这种方式是错误的//InputStreamstream=ThreadcurrentThread()getClass()getClassLoader()getResourceAsStream("commonproperties");//InputStreamstream=ThreadcurrentThread()getClass()getClassLoader()getSystemResourceAsStream("commonproperties");//InputStreamstream=thisgetClass()getClassLoader()getSystemResourceAsStream("commonproperties");//InputStreamstream=thisgetClass()getClassLoader()getResourceAsStream("commonproperties");//InputStreamstream=thisgetClass()getClassLoader()getSystemResourceAsStream("commonproperties");//InputStreamstream=CommonPropertiesUtilclassgetClassLoader()getResourceAsStream("commonproperties");//InputStreamstream=CommonPropertiesUtilclassgetClass()getClassLoader()getSystemClassLoader()getResourceAsStream("commonproperties");//InputStreamstream=CommonPropertiesUtilclassgetClass()getClassLoader()getSystemClassLoader()getSystemResourceAsStream("commonproperties");Propertiesproperties=newProperties();propertiesload(stream);contextPath=propertiesgetProperty("contextPath");Systemoutprintln(contextPath);}catch(FileNotFoundExceptione){
以上就是关于在jsp页面使用java代码,获取html页面中所有script标签里面的src 路径,并存到本地的文件夹中全部的内容,包括:在jsp页面使用java代码,获取html页面中所有script标签里面的src 路径,并存到本地的文件夹中、安卓手机如何打开.SRC文件、html(不是jsp)页面中 <script type = "" src = "" />怎么获取根目录等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)