473,382 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Uploading file in java

Hi there,can anyone tell me how to read multiple lines and store their value.

eg:file.txt

Probable Cause: The network operator has issued an alter attribute command for
the specified LCONF assign. The old value and the new value are show
Action Taken : The assign value is changed from the old value to the new
value. Receipt of this message does not guarantee that the new attribute
value was accepted by clients who use it. Additional messages may be.

Probable Cause: The network operator has issued an info attribute command for
the specified LCONF assign. The default value being used is displaye
Action Taken : None. Informational use only.

In above file,Probable Cause and Action Taken are the column of database table.And after Probable Cause: those are the value to be stored in the database table for probable cause column,same goes with action taken.

so how can i read the multiple lines and store their value.I have to read the value for probable cause until the line comes with Action Taken.I'm using bufferedReader and readLine() function read one line at a time.So can anyone tell me how to read directly from probable cause to action taken no matter how many line comes between them.

With regards
Biraj
Mar 20 '12 #1
4 1532
r035198x
13,262 8TB
If the value part will never contain a colon then read the value into a string until you encounter a line with a colon and don't include that line with the colon.
You can split the column name from the value part using String.split(":");
Mar 20 '12 #2
thanks for the answer.Can you provide me the code to read till colon appears.
Mar 20 '12 #3
r035198x
13,262 8TB
In your while loop when you read the line using
String line = br.readLine();
You check for : using if(line.contains("Probable Cause:")) { ...

You then separate the cause label from the cause text using line.split(":")
Mar 20 '12 #4
Thanks again that worked.
Mar 20 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jonathan | last post by:
Hi everyone, I have a problem with the file uploading in Asp.Net and I have read a lot on forums on this but never found an answer. Here is the problem: I know Asp.Net maximum Length for...
0
by: Przemyslaw Ciesielski | last post by:
Hi, I want to upload file from my C# application to java server (tomcat 4.1.30). On Java server i've got servlet for gettings file from POST and saving it. I tried from html <form> and it...
6
by: jackson | last post by:
Hi all, Im having problem when uploading file to localhost. but I can upload to drive c: any idea thanks
0
by: Monica | last post by:
I have a problem with uploading file into SQL 2005 DB using IIS 6.0 webserver, this code was working in SQL 2000 Db and IIS 5.0. Can you please help me to see what the problem is. Error msg :...
1
by: wenqiang7 | last post by:
I am encountering a very strang problem with file uploading in my ASP.Net page. When we try to upload certain file, we'll get an error msg of "Cannot find server or DNS Error". We are running...
0
by: Mika M | last post by:
Hi! I'm uploading file(s) over internet like... My.Computer.Network.UploadFile("C:\file1.txt", "ftp://some.domain.com/file1.txt", "MyUID", "MyPWD", False, 1000) ....and this is working...
3
by: detrox | last post by:
Hi, all I have two questions about uploading files using php & html: 1. How can i add a `file type' in the pop window when i click `browse' button of the `<input type=file>'. 2. How can i get...
2
by: ArwaAbood | last post by:
I want to upload file using the following code to make the form: <html> <head> <script type="text/javascript"> function redirect() { alert(msg+" want to add new file"); ...
1
by: jimmylee | last post by:
Hi All, Please help me . I am getting aspSmartUploadfile error while uploading file I have already instrall aspSmartUpload.dll and aspSmartUploadutil.dll. how to solve this error. thanks....
4
by: ish | last post by:
hello everybody...... plz help me out... how we can store the acual path of uploading file.i want to store the path of file in my database...bt i m not getting anyway to implement that......if...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.