[Java]?????????????
???????????? ???????[ 2017/1/20 10:41:50 ] ????????Java ??????? ???
????1????????????????
????2?????????????????
????3?????卸?????????
????4???????????????
????[Java]?????????????
????publicclassReadFromFile{
????/**
????*????????位??????????????????????????????????????????????
????*/
????publicstaticvoidreadFileByBytes(StringfileName){
????Filefile=newFile(fileName);
????InputStreamin=null;
????try{
????System.out.println("????????位?????????????味????????");
????//??味???????
????in=newFileInputStream(file);
????inttempbyte;
????while((tempbyte=in.read())!=-1){
????System.out.write(tempbyte);
????}
????in.close();
????}catch(IOExceptione){
????e.printStackTrace();
????return;
????}
????try{
????System.out.println("????????位?????????????味????????");
????//??味???????
????byte[]tempbytes=newbyte[100];
????intbyteread=0;
????in=newFileInputStream(fileName);
????ReadFromFile.showAvailableBytes(in);
????//??????????????????校?byteread???味?????????
????while((byteread=in.read(tempbytes))!=-1){
????System.out.write(tempbytes??0??byteread);
????}
????}catch(Exceptione1){
????e1.printStackTrace();
????}finally{
????if(in!=null){
????try{
????in.close();
????}catch(IOExceptione1){
????}
????}
????}
????}
????/**
????*????????位?????????????????????????????????
????*/
????publicstaticvoidreadFileByChars(StringfileName){
????Filefile=newFile(fileName);
????Readerreader=null;
????try{
????System.out.println("????????位?????????????味????????");
????//??味???????
????reader=newInputStreamReader(newFileInputStream(file));
????inttempchar;
????while((tempchar=reader.read())!=-1){
????//????windows?锟�?
??????????????????????????小?
????//??????????????????????????????小?
????//???????蔚?
??????????
?????????????????小?
????if(((char)tempchar)!='
'){
????System.out.print((char)tempchar);
????}
????}
????reader.close();
????}catch(Exceptione){
????e.printStackTrace();
????}
????try{
????System.out.println("????????位?????????????味????????");
????//??味???????
????char[]tempchars=newchar[30];
????intcharread=0;
????reader=newInputStreamReader(newFileInputStream(fileName));
????//???????????????????校?charread???味???????
????while((charread=reader.read(tempchars))!=-1){
????//??????蔚?
?????
????if((charread==tempchars.length)
????&&(tempchars[tempchars.length-1]!='
')){
????System.out.print(tempchars);
????}else{
????for(inti=0;i<charread;i++){
????if(tempchars[i]=='
'){
????continue;
????}else{
????System.out.print(tempchars[i]);
????}
????}
????}
????}
????}catch(Exceptione1){
????e1.printStackTrace();
????}finally{
????if(reader!=null){
????try{
????reader.close();
????}catch(IOExceptione1){
????}
????}
????}
????}
????/**
????*???????位????????????????????械????????
????*/
????publicstaticvoidreadFileByLines(StringfileName){
????Filefile=newFile(fileName);
????BufferedReaderreader=null;
????try{
????System.out.println("???????位?????????????味?????校?");
????reader=newBufferedReader(newFileReader(file));
????StringtempString=null;
????intline=1;
??????

???路???
??????????????????
2023/3/23 14:23:39???写?貌??????????
2023/3/22 16:17:39????????????????????些??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???路???????路
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11