Non-Deprecated StringBufferInputStream equivalent?

Documentation of LogManager. ReadConfiguration() says that it accepts data in java.util. Properties format.So, the really correct encoding-safe implementation is this.

Documentation of LogManager. ReadConfiguration() says that it accepts data in java.util. Properties format.So, the really correct encoding-safe implementation is this: String s = ...; StringBuilder propertiesEncoded = new StringBuilder(); for (int I = 0; I Append(String.

Format("\\u%04x", (int) c)); } ByteArrayInputStream in = new ByteArrayInputStream(propertiesEncoded.toString(). GetBytes("ISO-8859-1")); EDIT: Encoding algorithm corrected EDIT2: Actually, java.util. Properties format have some other restrictions (such as escaping of \ and other special characters), see docs EDIT3: 0x00-0x1f escaping removed, as Alan Moore suggests.

Good catch on unicode encoding specific to the properties file format. I believe this is correct as long as s is UTF-8. – Kaleb Pederson Jan 28 '10 at 23:32 @Kaleb: s will just be a String, in the same encoding Strings always use--you don't need to worry about that.

You only have to know the target encoding, which is ISO-8859-1 as @axtavt said. – Alan Moore Jan 29 '10 at 3:57 @axtavt: Your code will Unicode-escape all TAB, linefeed, form-feed, and carriage-return characters, which isn't right. Those only need to be escaped if they're part of a Properties key or element, and that should already have been taken care of by the time this method gets called.

– Alan Moore Jan 29 '10 at 4:12.

Use the ByteArrayInputStream, and be careful to specify an appropriate character encoding. E.g. ByteArrayInputStream(str.

GetBytes("UTF8")); You need to worry about the character encoding to determine how each character is converted to a set of bytes. Note you can use the default getBytes() method and specify the encoding the JVM runs with via -Dfile. Encoding=...

This won't work. ReadConfiguration() passes the stream to Properties#load(InputStream), and that method expects the stream to be ISO-8859-1, not UTF-8. – Alan Moore Jan 29 '10 at 4:04.

See java.io. ByteArrayInputStream String s = "test"; InputStream input = new ByteArrayInputStream(s. GetBytes("UTF8")).

This won't work. ReadConfiguration() passes the stream to Properties#load(InputStream), and that method expects the stream to be ISO-8859-1, not UTF-8. – Alan Moore Jan 29 '10 at 4:06 Then he can pass the ISO-8859-1 encoding to getBytes() – Kevin Jan 29 '10 at 14:00.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions