public InputStream openInputStream() throws IOException { return ((InputConnection) impl).openInputStream(); }
public DataInputStream openDataInputStream() throws IOException { return new DataInputStream(openInputStream()); }
public DataInputStream openDataInputStream() throws IOException { return new DataInputStream(openInputStream()); }
protected InputStream getResponse() throws IOException { int responseCode = connection.getResponseCode(); if (responseCode != HttpConnection.HTTP_OK) { throw new IOException("HTTP response code: " + responseCode); } return connection.openInputStream(); }
public InputStream openInputStream(String name) throws IOException { return ((InputConnection) open(name)).openInputStream(); }
/** * @see org.osgi.service.io.ConnectorService#openInputStream(java.lang.String) */ public InputStream openInputStream(String name) throws IOException { Connection connection = open(name, READ, false); if (!(connection instanceof InputConnection)) { try { connection.close(); } catch (IOException ioex) { } throw new IOException("Connection doesn't implement InputConnection" + connection.getClass()); } return ((InputConnection) connection).openInputStream(); }
public static InputStream openInputStream(String name) throws IOException { InputConnection con = ((InputConnection) openImpl(name, READ, false, false)); try { return con.openInputStream(); } finally { con.close(); } }
ConnectionFactory connFact = new ConnectionFactory(); ConnectionDescriptor connDesc = connFact.getConnection(your_url); HttpConnection httpConn = (HttpConnection) connDesc.getConnection(); try { httpConn.setRequestMethod(HttpConnection.GET); InputConnection inputConn = (InputConnection) httpConn; InputStream is = inputConn.openInputStream(); byte[] data =IOUtilities.streamToBytes(is); //the value in data will be the bytes of your file. // now if you want to save the file, you can do it here...... } catch (IOException e) { e.printStackTrace(); }
public OBEXSessionBase(StreamConnection conn, OBEXConnectionParams obexConnectionParams) throws IOException { if (obexConnectionParams == null) { throw new NullPointerException("obexConnectionParams is null"); } this.isConnected = false; this.conn = conn; this.obexConnectionParams = obexConnectionParams; this.mtu = obexConnectionParams.mtu; this.connectionID = -1; this.packetsCountWrite = 0; this.packetsCountRead = 0; boolean initOK = false; try { this.os = conn.openOutputStream(); this.is = conn.openInputStream(); initOK = true; } finally { if (!initOK) { try { this.close(); } catch (IOException e) { DebugLog.error("close error", e); } } } }