Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

File Formats  RSS feed

 
manny segarra
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing text out to a file, that will be used
to update an LDAP server, running on UNIX. How can I change
the file format to "UNIX"(instead of PC) so that the server will be able to read the file ? Didn't see anything on how this is accomplished.
To give you a reference, if you are running Windows and have access to TextPad, it gives you an option on saving the file format as "PC", "UNIX" or "MAC".
Thanx in advance !
Manny
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It isn't difficult, it just requires some basic knowledge of the system your on or going to. Base Encoding used by the system and character(s) used to determine line seperation. On Unix the Base Encoding is 7 bit ascii and the line seperation character is '\n'. From there you create an outputstream that allows you to write a byte[] and a single byte. My choice has been the DataOutputStream. But, you can use what you want.
With the DataOutputStream the code is something like:

DataOutputStream writeBytes() takes a string argument but, writes this to the outputstream as a byte[] and writeByte() takes an int and writes a single byte so, works fine.
Hope this helps
[This message has been edited by Carl Trusiak (edited November 01, 2000).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!