final InputStream openInputStream(HttpConnection conn) throws IOException { InputStream input = conn.getInputStream(); if (isGzipContent(conn)) input = new GZIPInputStream(input); return input; }
void openResponse() throws IOException { final int status = HttpSupport.response(conn); if (status != HttpConnection.HTTP_OK) { throw new TransportException(uri, status + " " //$NON-NLS-1$ + conn.getResponseMessage()); } final String contentType = conn.getContentType(); if (!responseType.equals(contentType)) { conn.getInputStream().close(); throw wrongContentType(responseType, contentType); } }
final InputStream openInputStream(HttpConnection conn) throws IOException { InputStream input = conn.getInputStream(); if (ENCODING_GZIP.equals(conn.getHeaderField(HDR_CONTENT_ENCODING))) input = new GZIPInputStream(input); return input; }
final InputStream openInputStream(HttpConnection conn) throws IOException { InputStream input = conn.getInputStream(); if (isGzipContent(conn)) input = new GZIPInputStream(input); return input; }
void openResponse() throws IOException { final int status = HttpSupport.response(conn); if (status != HttpConnection.HTTP_OK) { throw new TransportException(uri, status + " " //$NON-NLS-1$ + conn.getResponseMessage()); } final String contentType = conn.getContentType(); if (!responseType.equals(contentType)) { conn.getInputStream().close(); throw wrongContentType(responseType, contentType); } }
void openResponse() throws IOException { final int status = HttpSupport.response(conn); if (status != HttpConnection.HTTP_OK) { throw new TransportException(uri, status + " " //$NON-NLS-1$ + conn.getResponseMessage()); } final String contentType = conn.getContentType(); if (!responseType.equals(contentType)) { conn.getInputStream().close(); throw wrongContentType(responseType, contentType); } }
private void uploadContents(HttpConnection api, Map<String, LfsPointer> oid2ptr) throws IOException { try (JsonReader reader = new JsonReader( new InputStreamReader(api.getInputStream(), UTF_8))) { for (Protocol.ObjectInfo o : parseObjects(reader)) { if (o.actions == null) { continue; } LfsPointer ptr = oid2ptr.get(o.oid); if (ptr == null) { // received an object we didn't request continue; } Protocol.Action uploadAction = o.actions.get(OPERATION_UPLOAD); if (uploadAction == null || uploadAction.href == null) { continue; } Lfs lfs = new Lfs(getRepository()); Path path = lfs.getMediaFile(ptr.getOid()); if (!Files.exists(path)) { throw new IOException(MessageFormat .format(LfsText.get().missingLocalObject, path)); } uploadFile(o, uploadAction, path); } } }
new InputStreamReader(lfsServerConn.getInputStream(), UTF_8))) { Protocol.Response resp = gson.fromJson(reader, .getInputStream()) { long bytesCopied = Files.copy(contentIn, path); if (bytesCopied != o.size) {