public void close() throws IOException { client.closeFile(handle); } };
public void close() throws IOException { client.closeFile(finalHandle); } };
public void close() throws java.io.IOException { if (isClosed) { return; } try { client.closeFile(handle); } catch (IOException e) { throw e; } catch (Exception e) { throw new IOException(e.toString()); } isClosed = true; } };
@Override public void close() throws IOException { handle.getClient().closeFile(handle); } }
@Override public void close() throws IOException { handle.getClient().closeFile(handle); } }
@Override public void close() throws IOException { handle.getClient().closeFile(handle); } }
@Override public void close() throws IOException { handle.getClient().closeFile(handle); } }
@Override public void close() throws IOException { handle.getClient().closeFile(handle); } }
@Override public void close() throws IOException { handle.getClient().closeFile(handle); } }
/** * List the contents of a directory. * * @param dirName See the {@link SFTPv3Client comment} for the class for more details. * @return A Vector containing {@link SFTPv3DirectoryEntry} objects. * @throws IOException */ public List<SFTPv3DirectoryEntry> ls(String dirName) throws IOException { SFTPv3FileHandle handle = openDirectory(dirName); List<SFTPv3DirectoryEntry> result = scanDirectory(handle.fileHandle); closeFile(handle); return result; }
/** * List the contents of a directory. * * @param dirName See the {@link SFTPv3Client comment} for the class for more details. * @return A Vector containing {@link SFTPv3DirectoryEntry} objects. * @throws IOException */ public List<SFTPv3DirectoryEntry> ls(String dirName) throws IOException { SFTPv3FileHandle handle = openDirectory(dirName); List<SFTPv3DirectoryEntry> result = scanDirectory(handle.fileHandle); closeFile(handle); return result; }
/** * List the contents of a directory. * * @param dirName See the {@link SFTPv3Client comment} for the class for more details. * @return A Vector containing {@link SFTPv3DirectoryEntry} objects. * @throws IOException */ public List<SFTPv3DirectoryEntry> ls(String dirName) throws IOException { SFTPv3FileHandle handle = openDirectory(dirName); List<SFTPv3DirectoryEntry> result = scanDirectory(handle.fileHandle); closeFile(handle); return result; }
@Override public InputStream readFile(String path) { SFTPv3Client client = getClient(); String realPath = getRealPath(path); int startid = 0; try { if (!isDir(path)) { SFTPv3FileHandle handle = client.openFileRO(realPath); byte[] result = new byte[0]; byte[] tempResult = new byte[ONCE_MAX_BYTES]; int len = client.read(handle, startid, tempResult, 0, ONCE_MAX_BYTES); while (len == ONCE_MAX_BYTES) { result = byteMerger(result, tempResult); startid += len; len = client.read(handle, startid, tempResult, 0, ONCE_MAX_BYTES); } if (len > 0){ byte[] lastResult = new byte[len]; System.arraycopy(tempResult, 0, lastResult, 0, len); result = byteMerger(result, lastResult); } client.closeFile(handle); return new ByteArrayInputStream(result); } return null; } catch (IOException e) { LOG.error(e.getMessage()); return null; } }
public void get(String path, OutputStream out, long filePointer) throws SshException { SftpFile file = stat(path); try { SFTPv3FileHandle handle = client.openFileRO(path); try { byte[] buf = new byte[32768]; long fileOffset = filePointer; while (fileOffset < file.getSize()) { int r = client.read(handle, fileOffset, buf, 0, buf.length); out.write(buf, 0, r); fileOffset += r; } out.flush(); } finally { client.closeFile(handle); } } catch (SFTPException sftpe) { throw new SftpException(sftpe.getServerErrorCode(), sftpe.getLocalizedMessage()); } catch (IOException e) { throw new SshException(SshException.IO_ERROR, e); } }
client.closeFile(handle);
client.closeFile(handle);