replace « API « Java I/O Q&A





1. How to detect illegal UTF-8 byte sequences to replace them in java inputstream?    stackoverflow.com


The file in question is not under my control. Most byte sequences are valid UTF-8, it is not ISO-8859-1 (or an other encoding). I want to do my best do extract ...

2. Replacing strings in stream, using Swizzle Stream    stackoverflow.com

I've tried the Swizzle Stream library to replace tokens in an input stream.

  String RESOURCE_PATH = "FakePom.xml";
  InputStream pomIS = JarFinderServlet.class.getClassLoader().getResourceAsStream( RESOURCE_PATH );

  if( null == pomIS )
 ...

3. BufferedReader replacing in loop    stackoverflow.com

I'm trying to make this work, I don't understand why it doesn't work since it makes sense to me, but it doesn't make sense to java it seems. As you read the ...

4. how to replace a jar in another jar file?    stackoverflow.com

I am trying to replace a modified property.jar in WAS.jar, what's the quickest way to do this? Replacing normal files back to a jar is very easily by using input/output stream. ...

5. which class can be used in c++ in replacement of streamtokenizer in java?    stackoverflow.com

I need to write a program for assignment statement interpreter in c++.I have implemented the program in java.I need to tokenize the input which consists of numbers,words and operators(=,+,-,*,/).I used a ...

6. Java : DataInputStream replacement for endianness    stackoverflow.com

Below is my code that replaces the DataInputStream to wrap an InputStream, but provides extra methods to read little endian data types in addition to the normal methods that read big ...

7. Replacing a string in a byte stream    coderanch.com

Howdy folks! I've got a semi-unique problem. I've created a .XLS spreadsheet as a template with character string placeholders . I'm going to read in the .XLS template, and I need to figure out a way to find the strings and replace them without corrupting the file. I tried reading in the bytes and appending them to a StringBuffer then writing ...

8. Replacing text in a stream    coderanch.com

Is there a good way to replace text in a stream? I've created a servlet to read in the contents on an html page on another server and stream it out so it appears to be local. However, all relative paths are obviously broken. Below is my code so far, very simple. I have google as the URL for testing. public ...

9. FileInputStream - Replace Characters - FileInputStream    coderanch.com

I have the following situation: I am reading an XML file using FileInputStream and contents are sent to an unmarshaller method that accepts only FileInputStream. We have recently encountereda problem whereby the ampersnad character is not accpetable to the marshaller. My idea was to create a method that reads the file, replaces the ampersand character and writes back the contents to ...





10. Reading a cfg file, using bufferedreader trying to replace tabs =\    forums.oracle.com

What happens with your code if there is no '=' character in the line? indexOf('=') will return -1 and your code will break. This will also happen when there is no tab, or when there are a couple of spaces instead of a tab, in which case the bug will be harder to track down. Try a proper solution: [http://java.sun.com/docs/books/tutorial/essential/environment/properties.html]