Code example for DataInputStream

Methods: close, readFully

0
            byte[] body = null;
            if (entity != null) {
                try { 
                    if (entity.getContentLength() > 0) {
                        body = new byte[(int) entity.getContentLength()];
                        DataInputStream dis = new DataInputStream(entity.getContent());
                        try { 
                            dis.readFully(body);
                        } finally { 
                            try { 
                                dis.close();
                            } catch (IOException e) {
                                Log.e(TAG, "Unexpected IOException.", e);
                            } 
                        } 
                    } 
                } finally { 
                    if (entity != null) {
                        entity.consumeContent();
                    } 
                }