Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
abalfazl hossein wrote:Thanks Brother, But I want to know when a saves in two bytes, I want to know value of every bit of these two bytes.
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
2 to the 16th.Mohamed Sanaulla wrote: . . . larger number of characters (2^15?) . . .
Campbell Ritchie wrote:
2 to the 16th.Mohamed Sanaulla wrote: . . . larger number of characters (2^15?) . . .
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
abalfazl hossein wrote:My question is not only about my example. I mean that is there any method that read files as character, Then I don't need to cast.
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Jesper de Jong wrote:Obviously because only 7 bits are used the character set that you can represent with ASCII is limited.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
abalfazl hossein wrote:Then which method must be used?
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
abalfazl hossein
ابالفضل حسین
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException{
try {
BufferedReader i = new BufferedReader(new InputStreamReader
(new FileInputStream("myfile1.txt"),"UTF-8"));
String str1 = i.readLine();
System.out.println("File text : "+ str1);
System.out.println("Reading Process Completly Successfully.");
}
catch(UnsupportedEncodingException ue){
System.out.println("Not supported : ");
}
catch(IOException e){
System.out.println(e.getMessage());
}
}
}
File text : ?abalfazl hossein
Reading Process Completly Successfully.
abalfazl hossein wrote:Now what must I do?
System.out.println(System.getProperty("file.encoding"));
System.out.println(Charset.defaultCharset().name());
getDefaultCharSet()
System.out.println("Default Charset in Use=" + getDefaultCharSet());
compiling 1 source file to C:\Documents and Settings\Administrator\filereadchar_2\build\classes
C:\Documents and Settings\Administrator\filereadchar_2\src\filereadchar\Main.java:42: cannot find symbol
symbol : method getDefaultCharSet()
location: class filereadchar.Main
System.out.println("Default Charset in Use=" + getDefaultCharSet());
1 error
System.out.println("Default Charset in Use=" + getDefaultCharSet());
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Compiling 1 source file to C:\Documents and Settings\Administrator\filereadchar_2\build\classes
C:\Documents and Settings\Administrator\filereadchar_2\src\filereadchar\Main.java:34: cannot find symbol
symbol : method getDefaultCharSet()
location: class filereadchar.Main
System.out.println("Default Charset in Use=" + getDefaultCharSet());
1 error
Stephan van Hulst wrote: https://coderanch.com/t/511292/java/java/Byte-vs-Character-streams#2313347
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
abalfazl hossein wrote:Which font for arabic?
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Do you want ants? Because that's how you get ants. And a tiny ads:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|