Question: I have simple google maps div element. When user clicks `Submit` button expensive calculations gets trigged on backend therefore I want fade the whole google map in order to prevent user from navigating over and illustrate that job is in progress.

Simplified example: <http://jsfiddle.net/8jhsxbpo/4/>

```
  <div id="map_canvas" ></div>
  <button ng-click="getPlace()" type="button">Submit</button>

```

Note: Submit is not blocking the rest of the page. Doing it using angular `$http` service. 

```
$scope.getPlace = function(term, locale) {
    return $http.get('http://localhost:8080/search', {
        params: {
            term: term,
            locale: locale
        }
    }).then(function(response){
        renderMap(response);
    });
};

```

My project is written on Bootstrap 3 + Angular Js. 

Question: How do I fade or disable element and display loading icon while job is in progress?

Answer: 
Please check if the file represented by the `path` has a java object written to it.

 From the ObjectInputStream API doc <https://docs.oracle.com/javase/7/docs/api/java/io/ObjectInputStream.html>

> 
> An ObjectInputStream deserializes primitive data and objects previously written using an ObjectOutputStream.
> 
> 
> ObjectInputStream is used to recover those objects previously serialized.
> 
> 
> 

If you are doing a `this.ois.readObject()`, and you are getting a `-1`, there are chances that the file does not contain an object in it.

Update: `readObject` returns an object and not an `int`. If you are using the `read` methods in `ois`, and you are getting a `-1`, then the file is empty.

Also, there are chances that your file contains ***-1*** as its content ;)
The problem was that I was reading the `ObjectInputStream` the wrong way. It was like:

```
read.readExternal(ois);

```

but the correct way is:

```
read = (Product)ois.readObject();

```

And beacause of the Exceptions I was getting for doing so, I thought that the problem was with the construction of `ObjectInputStream` when using `ByteArrayInputStream`.
What a big mistake! :D

Thanks to everybody that tried to help.