/** * Auto-detect the appropriate file system abstraction. * * @return detected file system abstraction */ public static FS detect() { return detect(null); }
private static String readContentAsNormalizedString(DirCacheEntry entry, ObjectReader reader) throws MissingObjectException, IOException { ObjectLoader open = reader.open(entry.getObjectId()); byte[] cachedBytes = open.getCachedBytes(); return FS.detect().normalize(RawParseUtils.decode(cachedBytes)); }
/** * Get the default SSH session * * @return a remote session * @throws org.eclipse.jgit.errors.TransportException * in case of error with opening SSH session */ protected RemoteSession getSession() throws TransportException { if (sock != null) return sock; final int tms = getTimeout() > 0 ? getTimeout() * 1000 : 0; final FS fs = local == null ? FS.detect() : local.getFS(); sock = sch .getSession(uri, getCredentialsProvider(), fs, tms); return sock; }
/** * Reads the target of a symlink as a string. This default implementation * fully reads the entry's input stream and converts it to a normalized * string. Subclasses may override to provide more specialized * implementations. * * @param entry * to read * @return the entry's content as a normalized string * @throws java.io.IOException * if the entry cannot be read or does not denote a symlink * @since 4.6 */ protected String readSymlinkTarget(Entry entry) throws IOException { if (!entry.getMode().equals(FileMode.SYMLINK)) { throw new java.nio.file.NotLinkException(entry.getName()); } long length = entry.getLength(); byte[] content = new byte[(int) length]; try (InputStream is = entry.openInputStream()) { int bytesRead = IO.readFully(is, content, 0); return FS.detect() .normalize(RawParseUtils.decode(content, 0, bytesRead)); } }
FS fs = FS.detect(); if (globalAttributesPath.startsWith("~/")) { //$NON-NLS-1$ globalAttributesFile = fs.resolve(fs.userHome(), globalAttributesPath.substring(2));
/** * Auto-detect the appropriate file system abstraction. * * @return detected file system abstraction */ public static FS detect() { return detect(null); }
/** * Auto-detect the appropriate file system abstraction. * * @return detected file system abstraction */ public static FS detect() { return detect(null); }
public void connect() { try { SshSessionFactory sshSessionFactory = new SshSessionFactory(context); JSch jSch = sshSessionFactory.createDefaultJSch(FS.detect()); session = jSch.getSession( authData.getUser(), authData.getHost(), authData.getPort()); session.setPassword(AuthData.getInstance(context).getPassword()); // TODO: find a way to check for host key // jSch.setKnownHosts("/storage/sdcard0/Download/known_hosts"); session.setConfig("StrictHostKeyChecking", "no"); session.connect(); session.disconnect(); } catch (JSchException e) { e.printStackTrace(); } }
private static String readContentAsNormalizedString(DirCacheEntry entry, ObjectReader reader) throws MissingObjectException, IOException { ObjectLoader open = reader.open(entry.getObjectId()); byte[] cachedBytes = open.getCachedBytes(); return FS.detect().normalize(RawParseUtils.decode(cachedBytes)); }
private static String readContentAsNormalizedString(Entry entry) throws IOException { long length = entry.getLength(); byte[] content = new byte[(int) length]; InputStream is = entry.openInputStream(); IO.readFully(is, content, 0, (int) length); return FS.detect().normalize(RawParseUtils.decode(content)); }
private static String readContentAsNormalizedString(DirCacheEntry entry, ObjectReader reader) throws MissingObjectException, IOException { ObjectLoader open = reader.open(entry.getObjectId()); byte[] cachedBytes = open.getCachedBytes(); return FS.detect().normalize(RawParseUtils.decode(cachedBytes)); }
/** * Get the default SSH session * * @return a remote session * @throws TransportException * in case of error with opening SSH session */ protected RemoteSession getSession() throws TransportException { if (sock != null) return sock; final int tms = getTimeout() > 0 ? getTimeout() * 1000 : 0; final FS fs = local == null ? FS.detect() : local.getFS(); sock = sch .getSession(uri, getCredentialsProvider(), fs, tms); return sock; }
/** * Get the default SSH session * * @return a remote session * @throws org.eclipse.jgit.errors.TransportException * in case of error with opening SSH session */ protected RemoteSession getSession() throws TransportException { if (sock != null) return sock; final int tms = getTimeout() > 0 ? getTimeout() * 1000 : 0; final FS fs = local == null ? FS.detect() : local.getFS(); sock = sch .getSession(uri, getCredentialsProvider(), fs, tms); return sock; }
FS fs = FS.detect(); if (globalAttributesPath.startsWith("~/")) { //$NON-NLS-1$ globalAttributesFile = fs.resolve(fs.userHome(), globalAttributesPath.substring(2));
/** * Reads the target of a symlink as a string. This default implementation * fully reads the entry's input stream and converts it to a normalized * string. Subclasses may override to provide more specialized * implementations. * * @param entry * to read * @return the entry's content as a normalized string * @throws java.io.IOException * if the entry cannot be read or does not denote a symlink * @since 4.6 */ protected String readSymlinkTarget(Entry entry) throws IOException { if (!entry.getMode().equals(FileMode.SYMLINK)) { throw new java.nio.file.NotLinkException(entry.getName()); } long length = entry.getLength(); byte[] content = new byte[(int) length]; try (InputStream is = entry.openInputStream()) { int bytesRead = IO.readFully(is, content, 0); return FS.detect() .normalize(RawParseUtils.decode(content, 0, bytesRead)); } }
node.flush(); File gitPrefix = FS.detect().gitPrefix();