• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

readRecord()

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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???
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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???


 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic