Win a copy of Terraform in Action this week in the Cloud forum!

Beny Smith

Greenhorn
+ Follow
since Jul 31, 2018
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Beny Smith

Campbell Ritchie wrote:If you ook for Charset, you find it gives yiou some of the better known encodings, but Windows‑1252 isn't among them. Don't know what to suggest, sorry. What happens if you pass, "Windows-1252" or "ISO8859‑1" to a Scanner constructor?



I get empty lines instaed of file content in these cases. I tried already both of them.
3 years ago

Campbell Ritchie wrote:Why are you using anything with stream in its name? If you want to read text always use classes with reader in their name. It doesn't usually go wrong until you go beyond the bounds of plain simple ASCII or need encoding.
Where does that encoding detector come from? Apache Tika?
You will need lots more information to understand what is going wrong with the Scanner. You are using the method as a sort of black box, with file in and output out. Please go inside the method and put some debugging code in, so you can see what is actually happening.




Yes, I use Apache Tika. Encoding detection works great, I used some debug to check detected encoding. I used debug, to check first line, which is readed and it is also empty. So I couldn't debug anything between these two.
3 years ago
I use Apache Tika to get encoding of file. There are files with UTF-8 and ANSI encoding mixed in the same directory structure.



I use Scanner to read values from file.


Scanner is unable to read text from files with encoding windows-1252, I get empty string.

I have same problem in case of BufferedReader.



I tried this too, to determine encoding by markers, but it gives false results.
3 years ago
I try to save all the attachments from a SOAP response. I use following Groovy script.


I get following error message:

No such property : responseAttachments for class

3 years ago

Campbell Ritchie wrote:

Beny Smith wrote:. . . . It is just a sample command in this case.

I am afraid that won't help you. If we think that is the actual code you are using, we shall end up answering the wrong question.



I use this command too, so it is not a sample for forum. I use it to see effect of code execution.
3 years ago

Norm Radder wrote:

just create a FileInputStream  

Typo???
Try FileOutputStream.   FileInputStream will give: The system cannot find the file specified if the file doesn't exist.



I use that command to test my code. It is just a sample command in this case.
3 years ago
I try to use following command to execute a Windows command in a given directory.


It just open up a Command prompt in directory, where Java project is located. I tried this method too, but it has seemly no effect.
3 years ago