Results 1 to 5 of 5
  1. #1
    hill0093 is offline Member
    Join Date
    Mar 2013
    Posts
    20
    Rep Power
    0

    Default 8 or 16 bit characters

    When I use BufferedInputStream and BufferedOutputStream,
    I believe I am dealing in 8 bit bytes and characters.
    Am I correct?
    How do I work with 16-bit Unicode characters?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,560
    Blog Entries
    7
    Rep Power
    21

    Default Re: 8 or 16 bit characters

    Don't use Streams, use Readers and Writers and their compadres instead.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    hill0093 is offline Member
    Join Date
    Mar 2013
    Posts
    20
    Rep Power
    0

    Default Re: 8 or 16 bit characters

    I don't understand modern text handling.
    It looks like I have a lot of relearning to do.
    Do BufferedInputStream and BufferedOutputStream handle
    UTF-8 which, as I understand it from what I have read,
    can have more than one byte in a character? And do
    java Strings handle UTF-8? And is UTF-8 a good
    way to go? Where can I learn in one spot what
    to do to handle a wide range of characters?
    For a rough idea, the following are beginning lines
    from the methods I wrote years ago and still use,
    but I suppose I have to replace, and don't know how.

    public final static BufferedInputStream openBISFile(String inFilStg) {
    public final static int readLine(BufferedInputStream inFilStrm,StringBuffer lineImage) {
    public final static BufferedInputStream closBISFile(BufferedInputStream inFilStrm) {
    public final static int numOfFldsSplitFromCsvStgBufLine(StringBuffer csvStgBufLine,StringBuffer[]dtaFld) {
    public final static void removeLeadBlanksFromBuf(StringBuffer sb) {
    public final static void removeTrailBlanksFromBuf(StringBuffer sb) {
    public final static BufferedOutputStream openBOSFile(String ouFilStg,boolean wantNewFile) {
    public final static void println(BufferedOutputStream ouFilStrm,String strg) {
    public final static void flushBOSFile(BufferedOutputStream ouFilStrm) {
    public final static void closBOSFile(BufferedOutputStream ouFilStrm) {

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,650
    Rep Power
    5

    Default Re: 8 or 16 bit characters

    Check out the Oracle tutorials in my signature for info on file I/O.

    Both, UTF-8, and UTF-16 are supported. Checkout InputStreamReader (Java Platform SE 7 ) which is subclassed by
    FileReader.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,049
    Rep Power
    6

Similar Threads

  1. Comparing characters.
    By javajames in forum New To Java
    Replies: 11
    Last Post: 05-12-2011, 10:30 PM
  2. Need help with escape characters
    By jayjones149 in forum New To Java
    Replies: 1
    Last Post: 02-15-2010, 08:10 AM
  3. how to get the characters one by one from a String?
    By Somitesh Chakraborty in forum New To Java
    Replies: 3
    Last Post: 08-20-2008, 08:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •