Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

readRecord()

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To correct the deprecated methods one needs to use the String constructor which allows for the encoding to be specified. By using the
public String(byte[] bytes,
int offset,
int length,
String enc)
throws UnsupportedEncodingException
constrcutor. I note that it also throws an IndexOutOfBoundsException.
My question is where do people consider the best place to catch and handle this exception???
 
Marco Poehler
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can use the constructor:
String( bytes[] ascii, int offset, int length )
which uses the platforms default character encoding.
right ?
marco
Originally posted by benjamin wheeler:
To correct the deprecated methods one needs to use the String constructor which allows for the encoding to be specified. By using the
public String(byte[] bytes,
int offset,
int length,
String enc)
throws UnsupportedEncodingException
constrcutor. I note that it also throws an IndexOutOfBoundsException.
My question is where do people consider the best place to catch and handle this exception???

 
Thomas Mathai
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marco Poehler:
I think you can use the constructor:
String( bytes[] ascii, int offset, int length )
which uses the platforms default character encoding.
right ?
marco


IMHO, you do not really want to leave it to the platform's default encoding. Your binary file db.db uses only 1 byte per character. So you would want to enforce ISO-8859-1 encoding.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic