473,405 Members | 2,300 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,405 software developers and data experts.

File Handling issue in JAVA.

dmjpro
2,476 2GB
There r two kinds of streams ... BYTE and CHARACTER streams.

if i write a file in BYTE stream then i later read that file in CHARACTER stream.
any problem is there ???????.... i mean any character lose is there.

plz help.
kind regards.
dmjpro.
May 14 '07 #1
5 2017
JosAH
11,448 Expert 8TB
There r two kinds of streams ... BYTE and CHARACTER streams.

if i write a file in BYTE stream then i later read that file in CHARACTER stream.
any problem is there ???????.... i mean any character lose is there.

plz help.
kind regards.
dmjpro.
If/when you write your text using byte streams and you write ASCII characters
only (i.e. only the values 0x00 .. 0x7f) you can safely write bytes and read
chars and vice versa. This all because the first 128 byte values map to identical
values either using Unicode or ASCII.

For all other values >= 0x80 you need an en/decoding to and from Unicode chars.
A natural encoding is UTF/8. You can safely use a byte output stream for
writing UTF/8 encoded characters and read them using an UTF/8 decoder.
The same applies of course for the encoding/decoding methods.

Writing encoded bytes and reading and decoding bytes is a tedious job and
is best left to the Readers, Writers and String constructors which you can
pass the en/decoding method.

kind regards,

Jos
May 14 '07 #2
dmjpro
2,476 2GB
thanx for ur reply.

if i try to read an image file or others binary file using character streams then why can't i read the full file????????

actually i have to use byte stream for it.
plz explain.

kind regards.
dmjpro.
May 15 '07 #3
JosAH
11,448 Expert 8TB
thanx for ur reply.

if i try to read an image file or others binary file using character streams then why can't i read the full file????????

actually i have to use byte stream for it.
plz explain.

kind regards.
dmjpro.
When I read 'binary' file, character streams are a nono. You don't want character
translation to happen on binary data.

kind regards,

Jos
May 15 '07 #4
dmjpro
2,476 2GB
Thanx for ur reply.

Now it seems that the picture is more clearer.
So u mean that during Character Streams operation character translation is there.
One more thing frnd..... what do u mean by nono?
ok plz help this point.
If possible if u left anything in the previous discussion .... now fullfill this.
nothing more ....
a lot of things i learnt from u.

thanx thanx many many thanx again.

kind regards.
dmjpro.
May 16 '07 #5
JosAH
11,448 Expert 8TB
Thanx for ur reply.

Now it seems that the picture is more clearer.
So u mean that during Character Streams operation character translation is there.
One more thing frnd..... what do u mean by nono?
ok plz help this point.
If possible if u left anything in the previous discussion .... now fullfill this.
nothing more ....
a lot of things i learnt from u.

thanx thanx many many thanx again.

kind regards.
dmjpro.
'nono' is a bit of informal language; it means "it's not correct, don't do it", the
informal version reads: "it's a nono". ;-)

kind regards,

Jos
May 16 '07 #6

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

Similar topics

0
by: Jagdeesh | last post by:
Hai Colleagues, I am using Tomcat 4.1.24 and JDK 1.4.0_03 in my winXP machine. I've transferred a set of folders(containing jsp files) into tomcat's webapps directory(to /webapps/bob ,...
48
by: Joseph | last post by:
Hi I'm writing a commercial program which must be reliable. It has to do some basic reading and writing to and from files on the hard disk, and also to a floppy. I have foreseen a potential...
1
by: Daniel | last post by:
Hello I am developing a Java application for MacOS X, Windows and Linux. So far easy with Java. But when it comes to file types, the platfrom-specific handling knocks my application-created...
9
by: Hans-Joachim Widmaier | last post by:
Hi all. Handling files is an extremely frequent task in programming, so most programming languages have an abstraction of the basic files offered by the underlying operating system. This is...
3
by: Rajesh | last post by:
Hi, I am using iplanet webserver 4.1. I want to call a java class from ssjs file. But I am not getting the result. I have created a java class file and put it in the folder...
14
by: Al Smith | last post by:
I need help in implementing proper error handling. I am trying to upload a file based on the sample code below. The code works well except if the file selected is too big. I do know about the...
3
by: J055 | last post by:
Hi How do I tell the user he has tried to upload a file which is too big... 1. when the httpRuntime.maxRequestLength has been exceeded and 2. when the uploaded file is under then...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
1
by: abhuyan | last post by:
I need to find out if I can split a file , distribute it among remote systems & then fetch them back & merge the file using Java.Can this kind of File handling be done in Java?
7
by: =?Utf-8?B?THVib21pcg==?= | last post by:
Hi, Is it possible to set up C# compiler so that I would get a warning when I miss any exception thrown by a framework? Something like in Java, where the compiler forces you to handle all...
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: 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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.