SmbFile remoteFile; try { remoteFile = new SmbFile("smb://172.25.0.1/Public-01/Documents/Welcome.pdf"); OutputStream os = remoteFile.getOutputStream(); InputStream is = new FileInputStream("sdcard/Download/Welcome.pdf"); int bufferSize = 5096; byte[] b = new byte[bufferSize]; int noOfBytes = 0; while( (noOfBytes = is.read(b)) != -1 ) { os.write(b, 0, noOfBytes); } os.close(); is.close(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }
out = (SmbFileOutputStream)file.getOutputStream(); byte[] buf = new byte[5242880]; int len;
out = (SmbFileOutputStream)file.getOutputStream(); byte[] buf = new byte[5242880]; int len;
public OutputStream putFile(String path) throws IOException { SmbFile smbFile = new SmbFile(encodeForSmb(path), authentication); return smbFile.getOutputStream(); }
public OutputStream putFile(String path) throws IOException { SmbFile smbFile = new SmbFile(encodeForSmb(path), authentication); return smbFile.getOutputStream(); }
private void copySlaveJar(PrintStream logger, SmbFile remoteRoot) throws IOException { // copy slave.jar logger.println("Copying slave.jar"); copyStreamAndClose(Hudson.getInstance().getJnlpJars("slave.jar").getURL().openStream(), new SmbFile(remoteRoot,"slave.jar").getOutputStream()); }
private void copySlaveJar(PrintStream logger, SmbFile remoteRoot) throws IOException { // copy slave.jar logger.println("Copying slave.jar"); copyStreamAndClose(Hudson.getInstance().getJnlpJars("slave.jar").getURL().openStream(), new SmbFile(remoteRoot,"slave.jar").getOutputStream()); }
Assert.isTrue(tempFile.canWrite(), "Temporary file [" + tempFileName + "] is not writable."); FileCopyUtils.copy(_inputStream, tempFile.getOutputStream()); FileCopyUtils.copy(_inputStream, targetFile.getOutputStream());
copyStreamAndClose(getClass().getResource("/windows-service/hudson.exe").openStream(), new SmbFile(remoteRoot,"hudson-slave.exe").getOutputStream()); copyStreamAndClose(new ByteArrayInputStream(xml.getBytes("UTF-8")), new SmbFile(remoteRoot,"hudson-slave.xml").getOutputStream());
copyStreamAndClose(getClass().getResource("/windows-service/hudson.exe").openStream(), new SmbFile(remoteRoot,"hudson-slave.exe").getOutputStream()); copyStreamAndClose(new ByteArrayInputStream(xml.getBytes("UTF-8")), new SmbFile(remoteRoot,"hudson-slave.xml").getOutputStream());