Java Code Examples for com.squareup.okhttp.internal.Util#copy()
The following examples show how to use
com.squareup.okhttp.internal.Util#copy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Response.java From L.TileLayer.Cordova with MIT License | 6 votes |
public final byte[] bytes() throws IOException { long contentLength = contentLength(); if (contentLength > Integer.MAX_VALUE) { throw new IOException("Cannot buffer entire body for content length: " + contentLength); } if (contentLength != -1) { byte[] content = new byte[(int) contentLength]; InputStream in = byteStream(); Util.readFully(in, content); if (in.read() != -1) throw new IOException("Content-Length and stream length disagree"); return content; } else { ByteArrayOutputStream out = new ByteArrayOutputStream(); Util.copy(byteStream(), out); return out.toByteArray(); } }
Example 2
Source File: Response.java From IoTgo_Android_App with MIT License | 6 votes |
public final byte[] bytes() throws IOException { long contentLength = contentLength(); if (contentLength > Integer.MAX_VALUE) { throw new IOException("Cannot buffer entire body for content length: " + contentLength); } if (contentLength != -1) { byte[] content = new byte[(int) contentLength]; InputStream in = byteStream(); Util.readFully(in, content); if (in.read() != -1) throw new IOException("Content-Length and stream length disagree"); return content; } else { ByteArrayOutputStream out = new ByteArrayOutputStream(); Util.copy(byteStream(), out); return out.toByteArray(); } }
Example 3
Source File: Response.java From android-discourse with Apache License 2.0 | 6 votes |
public byte[] bytes() throws IOException { long contentLength = contentLength(); if (contentLength > Integer.MAX_VALUE) { throw new IOException("Cannot buffer entire body for content length: " + contentLength); } if (contentLength != -1) { byte[] content = new byte[(int) contentLength]; InputStream in = byteStream(); Util.readFully(in, content); if (in.read() != -1) throw new IOException("Content-Length and stream length disagree"); return content; } else { ByteArrayOutputStream out = new ByteArrayOutputStream(); Util.copy(byteStream(), out); return out.toByteArray(); } }
Example 4
Source File: Response.java From bluemix-parking-meter with MIT License | 6 votes |
public final byte[] bytes() throws IOException { long contentLength = contentLength(); if (contentLength > Integer.MAX_VALUE) { throw new IOException("Cannot buffer entire body for content length: " + contentLength); } if (contentLength != -1) { byte[] content = new byte[(int) contentLength]; InputStream in = byteStream(); Util.readFully(in, content); if (in.read() != -1) throw new IOException("Content-Length and stream length disagree"); return content; } else { ByteArrayOutputStream out = new ByteArrayOutputStream(); Util.copy(byteStream(), out); return out.toByteArray(); } }
Example 5
Source File: Response.java From reader with MIT License | 6 votes |
public final byte[] bytes() throws IOException { long contentLength = contentLength(); if (contentLength > Integer.MAX_VALUE) { throw new IOException("Cannot buffer entire body for content length: " + contentLength); } if (contentLength != -1) { byte[] content = new byte[(int) contentLength]; InputStream in = byteStream(); Util.readFully(in, content); if (in.read() != -1) throw new IOException("Content-Length and stream length disagree"); return content; } else { ByteArrayOutputStream out = new ByteArrayOutputStream(); Util.copy(byteStream(), out); return out.toByteArray(); } }
Example 6
Source File: Response.java From reader with MIT License | 6 votes |
public final byte[] bytes() throws IOException { long contentLength = contentLength(); if (contentLength > Integer.MAX_VALUE) { throw new IOException("Cannot buffer entire body for content length: " + contentLength); } if (contentLength != -1) { byte[] content = new byte[(int) contentLength]; InputStream in = byteStream(); Util.readFully(in, content); if (in.read() != -1) throw new IOException("Content-Length and stream length disagree"); return content; } else { ByteArrayOutputStream out = new ByteArrayOutputStream(); Util.copy(byteStream(), out); return out.toByteArray(); } }
Example 7
Source File: Response.java From cordova-amazon-fireos with Apache License 2.0 | 6 votes |
public final byte[] bytes() throws IOException { long contentLength = contentLength(); if (contentLength > Integer.MAX_VALUE) { throw new IOException("Cannot buffer entire body for content length: " + contentLength); } if (contentLength != -1) { byte[] content = new byte[(int) contentLength]; InputStream in = byteStream(); Util.readFully(in, content); if (in.read() != -1) throw new IOException("Content-Length and stream length disagree"); return content; } else { ByteArrayOutputStream out = new ByteArrayOutputStream(); Util.copy(byteStream(), out); return out.toByteArray(); } }
Example 8
Source File: Response.java From phonegapbootcampsite with MIT License | 6 votes |
public final byte[] bytes() throws IOException { long contentLength = contentLength(); if (contentLength > Integer.MAX_VALUE) { throw new IOException("Cannot buffer entire body for content length: " + contentLength); } if (contentLength != -1) { byte[] content = new byte[(int) contentLength]; InputStream in = byteStream(); Util.readFully(in, content); if (in.read() != -1) throw new IOException("Content-Length and stream length disagree"); return content; } else { ByteArrayOutputStream out = new ByteArrayOutputStream(); Util.copy(byteStream(), out); return out.toByteArray(); } }
Example 9
Source File: Response.java From CordovaYoutubeVideoPlayer with MIT License | 6 votes |
public final byte[] bytes() throws IOException { long contentLength = contentLength(); if (contentLength > Integer.MAX_VALUE) { throw new IOException("Cannot buffer entire body for content length: " + contentLength); } if (contentLength != -1) { byte[] content = new byte[(int) contentLength]; InputStream in = byteStream(); Util.readFully(in, content); if (in.read() != -1) throw new IOException("Content-Length and stream length disagree"); return content; } else { ByteArrayOutputStream out = new ByteArrayOutputStream(); Util.copy(byteStream(), out); return out.toByteArray(); } }
Example 10
Source File: Response.java From wildfly-samples with MIT License | 6 votes |
public final byte[] bytes() throws IOException { long contentLength = contentLength(); if (contentLength > Integer.MAX_VALUE) { throw new IOException("Cannot buffer entire body for content length: " + contentLength); } if (contentLength != -1) { byte[] content = new byte[(int) contentLength]; InputStream in = byteStream(); Util.readFully(in, content); if (in.read() != -1) throw new IOException("Content-Length and stream length disagree"); return content; } else { ByteArrayOutputStream out = new ByteArrayOutputStream(); Util.copy(byteStream(), out); return out.toByteArray(); } }
Example 11
Source File: Response.java From crosswalk-cordova-android with Apache License 2.0 | 6 votes |
public final byte[] bytes() throws IOException { long contentLength = contentLength(); if (contentLength > Integer.MAX_VALUE) { throw new IOException("Cannot buffer entire body for content length: " + contentLength); } if (contentLength != -1) { byte[] content = new byte[(int) contentLength]; InputStream in = byteStream(); Util.readFully(in, content); if (in.read() != -1) throw new IOException("Content-Length and stream length disagree"); return content; } else { ByteArrayOutputStream out = new ByteArrayOutputStream(); Util.copy(byteStream(), out); return out.toByteArray(); } }