Class NetRC


  • public class NetRC
    extends java.lang.Object
    NetRC file parser.
    Since:
    3.5
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  NetRC.NetRCEntry
      .netrc file entry
      (package private) static class  NetRC.State  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static java.lang.String DEFAULT_ENTRY
      'default' netrc entry.
      private java.util.Map<java.lang.String,​NetRC.NetRCEntry> hosts  
      private java.time.Instant lastModified  
      private java.io.File netrc  
      (package private) static java.util.regex.Pattern NETRC  
      private static java.util.TreeMap<java.lang.String,​NetRC.State> STATE  
    • Constructor Summary

      Constructors 
      Constructor Description
      NetRC()
      Constructor for NetRC.
      NetRC​(java.io.File netrc)
      Constructor for NetRC.
    • Field Detail

      • NETRC

        static final java.util.regex.Pattern NETRC
      • DEFAULT_ENTRY

        static final java.lang.String DEFAULT_ENTRY
        'default' netrc entry. This is the same as machine name except that default matches any name. There can be only one default token, and it must be after all machine tokens.
        See Also:
        Constant Field Values
      • netrc

        private java.io.File netrc
      • lastModified

        private java.time.Instant lastModified
      • STATE

        private static final java.util.TreeMap<java.lang.String,​NetRC.State> STATE
    • Constructor Detail

      • NetRC

        public NetRC()

        Constructor for NetRC.

      • NetRC

        public NetRC​(java.io.File netrc)

        Constructor for NetRC.

        Parameters:
        netrc - the .netrc file
    • Method Detail

      • getDefaultFile

        private static java.io.File getDefaultFile()
      • getEntry

        public NetRC.NetRCEntry getEntry​(java.lang.String host)
        Get entry by host name
        Parameters:
        host - the host name
        Returns:
        entry associated with host name or null
      • getEntries

        public java.util.Collection<NetRC.NetRCEntry> getEntries()
        Get all entries collected from .netrc file
        Returns:
        all entries collected from .netrc file
      • parse

        private void parse()