file
hi i want read special line of file. what am i doing ?
I write a code but is false in this programm i want make tree with java but i should read data from file. please help me!
void maketree(BtNode root,int i) throws FileNotFoundException, IOException{
FileInputStream fis=new FileInputStream("D:/myfile.txt");
DataInputStream dis=new DataInputStream(fis);
BufferedReader br= new BufferedReader(new InputStreamReader(dis));
String str[] = new String[130];
BsTree bs = new BsTree();
int index1=0;
int p=0;
String word1=null;
String mean1=null;
String n=null;
BtNode t=root;
if(i%2==0){
index1=str[i].indexOf("=");
System.out.println("index1:"+index1);
word1=str[i].substring(0, index1);
System.out.println("word1:"+word1);
mean1 =str[i].substring(index1+1,str[i].length());
System.out.println("mean1:"+mean1);
BtNode newnode=bs.creatnode(word1, mean1, null,null);
int s=word1.length();
System.out.println("s:"+s);
int s2=root.element1.length();
System.out.println("root.element1"+ root.element1);
System.out.println("s2:"+s2);
if(s<s2)
p=s;
else
p=s2;
System.out.println("p:"+p);
int sum=0,sum2=0;
for(int j=0;j<p;j++){
int c1=word1.codePointAt(j);
sum+=c1;
int c2=root.element1.codePointAt(j);
sum2+=c2;
}
if(sum<sum2){
root.setleft(newnode);
System.out.println("root.left.element1:"+root.left.element1);
//word1=root.left.element1;
//mean1=root.left.element2;
}else{
root.setright(newnode);
System.out.println("root.right.element1:"+root.right.element1);
//BtNode rigt=bs.creatnode(word1, mean1, null,null);
// BtNode rigt=root.right;
// word1=root.right.element1;
//mean1=root.right.element2;
}
maketree(newnode,i++);
//n= word1;
//n=st;
}
}
protected BtNode creatnode(String element1,String element2,BtNode left,BtNode right){
return new BtNode(element1, element2, left,right);
}
View Answers
January 9, 2012 at 11:06 AM
Related Tutorials/Questions & Answers:
FileFile How to create .Exe
file in jana
filefile how can copy the information in the
file to the string?
Store
file data into String
Advertisements
filefile Could anyone please help me to write a code that does the following: Opens a
file named MyName.txt, reads the first line from the
file and displays it, and then closes the
file.
Thank you so much
filefile how can add the information to the graphic
file filefile Hi,what can delet some of the information of the
file filefile Hi,how can delet some of the information of the
file File File How to find all files in our local computer using java
FILEFILE There is a
file named Name.txt that contains information related to appliances.I want to read the contents of this
file and I used the code... args[])
{
try
{
File file=new
File("Name.txt");
FileReader f=new FileReader(
file filefile hi i want read special line of
file. what am i doing ?
I write... read data from
file. please help me!
void maketree(BtNode root,int i) throws... at the following link:
Read specific line from
file File path for jar fileFile path for jar file Hi Experts,
I have created one eclipse... jar
file of that application, unfortunately it is giving the error that resource not found for the template
file.
Also I had tried to get that path from user
File manipulationsFile manipulations how to read the contents from one
file and move the contents to another
file EAR file EAR
file What is the EAR
file ?
An EAR
file is a standard JAR
file with an .ear extension, named from Enterprise ARchive
file. A J2EE application with all of its modules is delivered in EAR
file File OperationsFile Operations Please i would like to know if it is possible to read from a
file and write to the same
file at the same time
File TransferFile Transfer How to create a
file in server side using java swing
File UploadFile Upload when i execute the image upload to mysql database it shows an exception that
file path cannot be found
deleting file deleting
file how to delete a
file from a folder and its corresponding path in database using a servlet
File HandlingFile Handling how we do
file handling of parsed XML code bu DOM in java
JSP FileJSP File Hi,
What is JSP
File? How to create JSP
file?
Thanks
Hi,
JSP
file is simple text
file with .jsp extenstion. You can run JSP
file on tomcat server.
Read more at JSP tutorials section.
Thanks
JAR FILEJAR FILE WHAT IS JAR
FILE,EXPLAIN IN DETAIL?
A JAR
file... and applications.
The Java Archive (JAR)
file format enables to bundle multiple files into a single archive
file.
For more information, visit the following
on file systemon
file system how to maintains record in a
file using java and how to create objects to each record.
Hi,
Please read Java Write
file tutorial.ADS_TO_REPLACE_1
Regards
Deepak
File UploadFile Upload Hi
I need script / string in PHP where I uploaded the
file in html frontend and it should sent the uploaded
file as attachment to my email address
jar filejar file steps to create jar
file with example
jar filejar file how to create a jar
file in java
File handligFile handlig
File hyandling
Hi Please the click on the following link
Java
file Handling
And read the Articles given in it
Hi Please the click on the following link
Java
file Handling
And read
FILE CONCEPTFILE CONCEPT Prompt the user to enter the name of a text
file to search for. If the name does not end in a .txt extension, display an error message. Search for this
file in the current directory. If the
file does not exist print
class fileclass file How to create class
file in jsf easily
jar filejar file jar
file where it s used
file readfile read hi i am reaing from a
file which has punjabi words. can some one help with me some code
File transferFile transfer Hi there... I would like to know is it possible to transfer files from one directory to another with out
file io operations
file downloadfile download I uploaded a
file and saved the path in database. Now i want to download it can u plz provide code
file searchingfile searching i need a prog for searching inside a text
file after evry 1 min to find does it hav any new entry
file uploadfile upload how to recieve the uploaded
file on the next jsp page for modification if its uploaded to the previous page using a from
read a fileread a file read a
file byte by byte
import java.io.File..._TO_REPLACE_1
public static void main(String[] args) {
File file = new
File("D://Try.txt");
try {
FileInputStream fin = new FileInputStream(
file Property FileProperty File how to store key & values pair in property
file?
Note: In property
file keys should be displayed in ascending order.
please reply...");
properties.setProperty("National-Bird", "Peacock");
File file = new
File jsp-filejsp-file i want to upload a
file by browse button and the
file should be save in ms access database.....how i can implement trough jsp plz help me sir
file operationsfile operations everytime we run the program the data in the already
file is overridding ,so,how to append the data to the already existing files .so please send the function required and also source code
file uploadingfile uploading How to upload music files onto the server and save the
file information to the mysql database fetch and play the music files on a display page without download thus streaming the files
generate filegenerate file How to generate
file(.doc or .xls or .txt ) with containing data in it.By clicking on a link
jar filejar file how to run a java
file by making it a desktop icon i need complete procedur ..through cmd
file classfile class Hi Friend, I have a
file class it lets me extract all the data from a csv
file but I need to align the data properely, seperating... void ReadCSV(){
File csvFile = new
File("Hotels.csv
file attachfile attach how pick up the
file from database and attach it to the mail in java
Hi,
Here is the code to read image (
file) from...();
}
After reading the image you can save into
file or attach as attachment in your
File handlingFile handling how do i search for an occurance of a word in a
file... in a
file
import java.io.*;
import java.util.*;
class FileOperations{
public static void main(String[] args)throws Exception{
int count=0;
File f
war filewar file where should we create this war
file in servlet program for example servlet structure like this
1.app(servlet)
2.WEB-inf(web.xml)
3.class(.class