Loads the {@link TemporalSemanticSpace} from the sparse text formatted
file.

@param sspaceFile a file in {@link TSSpaceFormat#SPARSE_TEXT sparse text}
format
12948
private Map<String,SemanticVector> loadSparseText(File sspaceFile) 
        throws IOException {

        LOGGER.info("loading sparse text TSS from " + sspaceFile);

        BufferedReader br = new BufferedReader(new FileReader(sspaceFile));
        String[] header = br.readLine().split("\\s+");
        int words = Integer.parseInt(header[0]);
        dimensions = Integer.parseInt(header[1]);
        
        Map<String,SemanticVector> wordToSemantics = 
            new HashMap<String,SemanticVector>(words, 2f);
            
        for (int wordIndex = 0; wordIndex < words; ++wordIndex) {
            String[] wordAndSemantics = br.readLine().split("\\|");
            String word = wordAndSemantics[0];
            SemanticVector semantics = new SemanticVector(dimensions);
            wordToSemantics.put(word, semantics);

            LOGGER.info("loading " + wordAndSemantics.length + 
                " timesteps for word " + word); 

            // read in each of the timesteps
            for (int tsIndx = 1; tsIndx < wordAndSemantics.length; ++tsIndx) {
                String[] tsAndVec = wordAndSemantics[tsIndx].split("%");
                String[] tsAndNonZero = tsAndVec[0].split(" ");
                long timeStep = Long.parseLong(tsAndNonZero[0]);
                updateTimeRange(timeStep);
                int nonZero = Integer.parseInt(tsAndNonZero[1]);
                String[] vecElements = tsAndVec[1].split(",");
                
                Map<Integer,Double> sparseArr = new IntegerMap<Double>();
                // elements are ordered as pairs of index,value,index,value,...
                for (int i = 0; i < vecElements.length; i += 2) {
                    Integer index = Integer.valueOf(vecElements[i]);
                    Double value = Double.valueOf(vecElements[i+1]);
                }
                semantics.setSemantics(timeStep, sparseArr);
            }
        }

        return wordToSemantics;
    }
130215
public void useNamespace(SerializerContext serializerContext, ElementDescriptor<?> elementDescriptor)
	{
		useNamespace(serializerContext, elementDescriptor.qualifiedName.namespace);
	}
1241467
@SuppressWarnings("resource")
	public ISynchronizationPoint<Exception> registerNamespace(String namespace, String path, ClassLoader classLoader) {
		Namespace ns;
		SynchronizationPoint<Exception> sp = new SynchronizationPoint<>();
		synchronized (namespaces) {
			ns = namespaces.get(namespace);
			if (ns == null) {
				ns = new Namespace();
				ns.loading = sp;
				namespaces.put(namespace, ns);
			} else {
				ns.loading.cancel(new CancelException("Namespace overriden"));
				ns.loading = sp;
				ns.languages = null;
			}
		}
		ns.classLoader = classLoader;
		ns.path = path;
		IOProvider.Readable provider = new IOProviderFromPathUsingClassloader(classLoader).get(path + ".languages");
		IO.Readable input;
		try { input = provider == null ? null : provider.provideIOReadable(Task.PRIORITY_RATHER_IMPORTANT); }
		catch (IOException e) {
			sp.error(new Exception("Localized properties for namespace " + namespace
				+ " cannot be loaded because the file " + path + ".languages does not exist", e));
			logger.error(sp.getError().getMessage());
			return sp;
		}
		if (input == null) {
			sp.error(new Exception("Localized properties for namespace " + namespace
				+ " cannot be loaded because the file " + path + ".languages does not exist"));
			logger.error(sp.getError().getMessage());
			return sp;
		}
		AsyncWork<UnprotectedStringBuffer, IOException> read = IOUtil.readFullyAsString(
			input, StandardCharsets.US_ASCII, Task.PRIORITY_RATHER_IMPORTANT);
		Namespace toLoad = ns;
		read.listenAsyncSP(new Task.Cpu.FromRunnable("Read localized properties namespace file", Task.PRIORITY_RATHER_IMPORTANT, () -> {
			List<Namespace.Language> languages = new LinkedList<>();
			UnprotectedStringBuffer str = read.getResult();
			for (UnprotectedStringBuffer s : str.split(',')) {
				s.trim().toLowerCase();
				if (s.length() == 0) continue;
				Namespace.Language l = new Namespace.Language();
				List<UnprotectedStringBuffer> list = s.split('-');
				l.tag = new String[list.size()];
				int i = 0;
				for (UnprotectedStringBuffer us : list) l.tag[i++] = us.asString();
				languages.add(l);
			}
			languages.sort(new Comparator<Namespace.Language>() {
				@Override
				public int compare(Namespace.Language l1, Namespace.Language l2) {
					/* Order:
					 *  tags are alphabetically ordered
					 *  but tags xx-yy are before tag xx
					 */
					int i = 0;
					do {
						if (i == l1.tag.length) return 1;
						if (i == l2.tag.length) return -1;
						int c = l1.tag[i].compareTo(l2.tag[i]);
						if (c != 0) return c;
						i++;
					} while (true);
				}
			});
			toLoad.languages = languages.toArray(new Namespace.Language[languages.size()]);
			// set parents
			for (int i = 0; i < toLoad.languages.length; ++i) {
				// they are ordered, so the parent is after
				int nbI = toLoad.languages[i].tag.length;
				for (int j = i + 1; j < toLoad.languages.length; ++j) {
					int nbJ = toLoad.languages[j].tag.length;
					if (nbJ >= nbI) continue;
					if (ArrayUtil.equals(toLoad.languages[i].tag, 0, toLoad.languages[j].tag, 0, nbJ))
						toLoad.languages[i].parent = toLoad.languages[j];
					break;
				}
			}
			sp.unblock();
			logger.info("Namespace " + namespace + " loaded with " + languages.size() + " languages from " + path);
		}), sp);
		sp.listenInline(() -> { input.closeAsync(); });
		sp.onError((error) -> {
			logger.error("Error loading localized properties namespace file " + path + ".languages", error);
		}
187780
public static String datetimeToCustomString(SimpleDateFormat sdf, Date datetime) {
        return Checker.isNull(datetime) ? "" : sdf.format(datetime);
    }
48837
public static Scs cs_load(String fileName) {
        int i, j;
        float x;
        Scs T;
        BufferedReader in;
        try {
            in = new BufferedReader(new FileReader(fileName));
        } catch (FileNotFoundException e1) {
            return (null);
        }
        T = Scs_util.cs_spalloc(0, 0, 1, true, true); /* allocate result */
        String line;
        try {
            while ((line = in.readLine()) != null) {
                String[] tokens = line.trim().split("\\s+");
                if (tokens.length != 3) {
                    return null;
                }
                i = Integer.parseInt(tokens[0]);
                j = Integer.parseInt(tokens[1]);
                x = Float.parseFloat(tokens[2]);
                if (!Scs_entry.cs_entry(T, i, j, x))
                    return (null);
            }
        } catch (IOException e) {
            return (null);
        }
        return (T);
    }
820976
function AddSpaces (spaces) {

		async function MrkSpace(spaces) {
			let util = require('util'),
				rdfl = util.promisify(fs.readFile),
				fldr = Publics.Folder.index;
			// ------------------------------------------
			try { 
				if (!!!spaces) throw new Error('No Spaces');
				return await rdfl(fldr, 'utf8'); 
			} catch (err) {
				LG.Error(err, 'EXTERNAL', 'Markup');
				return null;
			}
		}

		function LogSpace (nme, dsc = '', kind = 'normal') {
			let msf = 'An Application for %s', nmf = '%15-s',
				name = nmf.format(nme), opts = [];
			switch (kind) {
				case 'global': opts = ['^^^^^', 'blue']; break;;
				case 'render': opts = ['Rendered', 'magenta']; break;;
				case 'normal': opts = [msf.format(dsc), 'gray']; break;;
			};
			LG.Server(name, 'NameSpace', ...opts);
		};

		function AddSpace (name, accessor) {
			accessor = !!accessor;
			/////////////////////////////////////////////////////////////////////////////
			let url   = `/${name}`,
				space = IO.of(url),
				globl = name.match(/^gbl-/),
				epnts = [],
				hndls = Socks.filter(v => {
							var key = TLS.Path([v[0], v[2]]),
								mch = !!key.match(/^\/auth\//),
								res = (mch == accessor);
							!!res && epnts.push(key); return res;
						})
						.map(v => { let a = v.slice();
							// Remove checks/limits for System API, if needed
							globl && (a[3] = [],a[4] = null);
							// Create Routers for Socket User
							return ReqSocket(...a);
						});

			/////////////////////////////////////////////////////////////////////////////
			space.on("connection", socket => {

				/////////////////////////////////////////////////////////////////////
				// VAR / FUNCTIONS //////////////////////////////////////////////////

					let Req, token, MID = '', SID = '', NID = '', RID, Checker = ReqHandle.Check(),
						LGMSG 	= 	(kind,err,msg)=>[kind,msg||(err||{}).message].filter(v=>!!v).join(' - '),
						LGERR	= 	(kind,err,clr='red')=>LG.Error(MID,'Session',LGMSG(kind,err),clr),
						LGSRV	= 	(kind,clr='yellow')=>LG.Server(MID,'Session',kind,clr),
						Init 	= 	() => {
							// Get Session Data
							Req = socket.request; token = '';
							SID = Req.sessionID; RID = socket.id;
							MID = SID+RID; NID = url+'#'+SID;
							// For General Messages
							LG.Server(SID,'Session','Detaching', 'magenta');
							// Setup the Ednpoints
							hndls.map(v => v(socket));
							// For Auth Messages
							/* !globl &&  */accessor && socket.join(SID);
						},
						Check 	= 	() => {
							if (!globl && accessor) {
								LGSRV('Checking', 'blue');
								let Res = new SocketRes(socket);
								Checker(Req,Res,(err,ret)=>{
									if (!!!(err||ret)) return;
									let { status, payload } = (err||ret);
									delete payload.options.body.reqid;
									Res.status(status).send(payload);
								});
							}
						},
						Sessers = 	(sync = 1, key, post = (()=>true)) => {
							socket.on(key, (!!!sync ?
								async (data = {}) => { try { 
									await ReqSession[key](Req, data); LGSRV(key); post(); }
									catch(err) { LGERR(key, err); } 
								} :   (data = {}) => { 
									try { ReqSession[key](Req, data); LGSRV(key); post(); }
									catch(err) { LGERR(key, err); } 
								}));
						};

				/////////////////////////////////////////////////////////////////////
				// HANDLERS /////////////////////////////////////////////////////////

					// Remove Stale Listeners
						socket.removeAllListeners('Save');
						socket.removeAllListeners('Renew');
						socket.removeAllListeners('Reload');
						socket.removeAllListeners('Regenerate');
						socket.removeAllListeners('Destroy');
						socket.removeAllListeners('reconnect_attempt');
						socket.removeAllListeners('error');
						socket.removeAllListeners('disconnect');

					// Determine Socket's Intention
						if (!globl) {
							if (accessor) {
								// For Session Renewing
								Sessers( true, 'Save');
								// For Session Renewing
								Sessers( true, 'Renew');
								// For Session Reloading
								Sessers( true, 'Reload');
								// For Session Regeneration
								Sessers(false, 'Regenerate', Init);
								// For Session Destroying
								Sessers( true, 'Destroy');
							} else {
								// For Broadcasting End-Points to Client
								let sobj = Pages[name], dobj = Pages['default'],
									head = socket.handshake.headers, 
									host = head.host, refr = head.referer,
									regx = `^https?:\/{2}${host}(\/.+)$`,
									path = refr.replace(new RegExp(regx),"$1"),
									LKID = ReqIOID(socket.request),
									LOKR = Session.Stores.Lockers;
								// -------------------------------------------------------
								if (!!!sobj) sobj = dobj;
								sobj.Data  = (sobj.Data ||dobj.Data );
								sobj.Build = (sobj.Build||dobj.Build);

								var send = res => socket.compress(true).emit(
										'build', (JSON.parse(res)||[{}])[0]
									);

								// -------------------------------------------------------
								function Builder() {
									LOKR.get(LKID,(err,res)=>send(res||"[{}]"));
								}
								// -------------------------------------------------------
								socket.on('setup', Builder);
							}
						} else {
							socket.emit('points', epnts);
						}

					// General Handles
						socket.on('reconnect_attempt', num => {
							LGERR('Reconnecting', {message:'%d Attempt%s'.format(num,(num>1?'s':''))});
						});
						socket.on('error', err => LGERR('Error', err));
						socket.on('disconnect', () => LGERR('Disconnected'));

				/////////////////////////////////////////////////////////////////////
				// SETUP ////////////////////////////////////////////////////////////

					// Log the Connection
					Init(); LGSRV('Connected');
					// Check if Authorized
					!globl && Check();

			}); return space;
		}

		function AddSite  (space, markup) {
			let refl =  'route.js | AddSpaces.AddSites |',
				cnfg = 	Assign({}, space.config),
				regx = 	{
					spce: 	/((?:<\w+\b|[\w=]+=(["']).+?\2(?=\s|)) )[\s\n]+/g,
					nwln:	/\n+\t*/g,
					scss: 	/^.+<!-{2}[{]{2}CSS[}]{2}-{2}>.+$/gm,
					vars: 	/<!-{2}[{]{2}([A-Z]+)[}]{2}-{2}>/g,
					objs: 	/\{\/\*!- CONFIG -\*\/\}/g,
					lckr: 	/\/\*!- LOCKER -\*\//g,
					styl: 	/\/\*!- STYLES -\*\//g,
					html: 	/<!-{2}CONTENT-{2}>/g,
					clsr:	/\/>/g,
					quot:	/&#x27;/g,
					plce: 	/-{2}[{]{2}([A-Z.]+)[}]{2}-{2}/g,
				},
				repl = 	(rnd, lid, cfg) => ({
					spce:	'$1',
					nwln:	'',
					scss:   ($0 => cfg.page.CSS.map(C =>
								$0.replace(/<!-{2}[{]{2}CSS[}]{2}-{2}>/g, C)
							).join('\n')),
					vars: 	($0, $key) => (cfg[$key.toLowerCase()]||''),
					objs: 	($0 => JSON.stringify(cfg||{})),
					lckr: 	($0 => lid),
					styl: 	($0 => cfg.page.styles?(rnd.Styles||''):''),
					html: 	($0 => rnd.HTML||''),
					clsr:	'>',
					quot:	"'",
					plce: 	(usr => ($0, $key) => { try { 
								let key = $key.toTitleCase(),
									val = `usr.Profile.${key}`;
								return eval(val); 
							} catch (e) { return ''; }; }),
				}),
				sani = 	(mark, data) => mark
							.replace(regx.spce,data.spce)
							.replace(regx.nwln,data.nwln)
							.replace(regx.scss,data.scss)
							.replace(regx.vars,data.vars)
							.replace(regx.objs,data.objs)
							.replace(regx.lckr,data.lckr)
							.replace(regx.styl,data.styl)
							.replace(regx.html,data.html)
							.replace(regx.clsr,data.clsr)
							.replace(regx.quot,data.quot),
				mkup =  markup,
				head = 	{
					'Content-Type':  'text/html',
					'Cache-Control': 'no-cache', // `public, max-age=${Publics.Age}`
				},
				LOKR =  Session.Stores.Lockers,
				ICO   = (head, url) => (
					head.referer == url && 
					!!head.accept.match(
						/image\/(?!webp|apng)/g
				)	);
			// -----------
			return function AddingSite(req, res) {
				let path  = req.originalUrl,
					host  = req.headers.host,
					ptcl  = req.protocol,
					hdrs  = req.headers,
					url   = `${ptcl}://${host}${path}`,
					EIF   = (cnfg.errorIF||(()=>false)),
					RDR   = (rnd, res, lid) => (
								rnd.Clear(lid),
								res.redirect(307, '404')
							),
					HTM   = async (usr,cfg,lid,rnd,res,ret=null) => {
								let cont, stat, rep, ctn, pay, eif = false;
								// -----------------------------------------------
									cfg.title = cfg.page.title(path,usr,pay);
									rnd.Auth(cfg.title);
								// -----------------------------------------------
									if (!!ret) pay = ret.payload.result;
								// -----------------------------------------------
									eif  = cfg.errorIF(ret); 
									if (eif) RDR(rnd, res, lid);
								// -----------------------------------------------
									try { 
										rnd.HTML = rnd.Render(pay); 
									} catch (e) { 
										console.log('RNDR ERR:', e); 
										RDR(rnd, res, lid);
									};
								// -----------------------------------------------
									rep  = repl(rnd, lid, cfg);
									ctn  = sani(mkup, rep);
								// -----------------------------------------------
									res.status(200).send(ctn);
								// -----------------------------------------------
									cont = JSON.stringify([rnd.Build(pay)]);
									stat = await LOKR.set(lid,cont,'EX',300);
									LG.NOW(`${refl} CALL CACHED: <%s>`, stat);
									rnd.Clear(lid);
							};
				// ------
				if (ICO(hdrs,url)) {
					// console.log({
						// headers:        req.headers,
						// method:         req.method,
						// params:         req.params,
						// url:            url,
						// statusCode:     req.statusCode,
						// statusMessage:  req.statusMessage,
						// upgrade:        req.upgrade,
					// });
					res.end();
				} else {
					// ------
					cnfg.host = `${ptcl}://${host}`;
					cnfg.errorIF = (...args) => {
						try { return EIF(...args); }
						catch (e) { return true; }
					};
					// ------
					LG.Timed(async () => {
						let rnd, call, ret,
							lid = ReqIOID(req),
							usr = req.profile, 
							cfg = Imm.fromJS(cnfg).toJS();
						// ------
						rnd = Renders(global,cfg,REST,usr,path,lid);
						res.header(head);
						// ------
						try {
							if (!!rnd.Call) {
								let { params, query, body, files } = req;
								// ------
								call = rnd.Call(path,params,query,body,files,usr);
								// ------
								ret  = await REST.Remote[call.method](
									call.path, 
									call.params,
									call.query||call.body, 
									call.files
								);
							};
							HTM(usr,cfg,lid,rnd,res,ret);
						} catch (err) { 
							let obj = { message: err.message, stack: err.stack },
								msg = JSON.stringify(obj, null, '    ');
							console.log(`${refl} CALL CACHE ERROR:`, msg, '\n');
							!!rnd.Redirect && res.redirect(301,rnd.Redirect);
						};
					},	req.sessionID, 'EXTERNAL', req.originalUrl, 'magenta');
				};
			};
		}

		// Configure External/Socket Routes
		// Initialize the Custom Namespaces, if available
		MrkSpace(spaces).then(mark => {
			let GBL = spaces.Global, EXPOSES = GBL.expose;
			// ----------------------------------------------------------------
			Imm	.OrderedMap(spaces)
				.filter((v,k)=>k!='Global'&&v.config.name!='global')
				.map((v,k) => {
					let c = v.config,
						nme = c.name,
						dsc = c.description,
						acc = c.accessor,
						stc = c.restrict,
						sch = c.scheme,
						url = `/${nme}`,
						gbl = EXPOSES.has(nme);
					// Create Socket Space
					Spaces[k] = AddSpace(nme, acc); LogSpace(nme, dsc);
					// Handle Globals, Accessors, Sites
					switch (true) {
						// Setup any Global Namespaces
						case gbl: 	let gme = `gbl-${nme}`; 
									Spaces[k] = AddSpace(gme, acc);
									LogSpace(gme, '', 'global');;
						// This sets any Accessors
						case acc: 	Session.Accessor = Spaces[k]; break;;
						// This handles the NameSpace Sites
						default: 	let rou = Express.Router(), ste, 
										chk = ReqHandle.Check(stc);
									Sites[k] = ste = AddSite(v, mark);
									rou .get('/', chk, ste); 
									rou.post('/', chk, ste);
									API.use(!!sch?sch:url, rou); 
									LogSpace(nme, '', 'render');
					}
			});
		}).catch(err => {
			// Otherwise, add placeholder NameSpace
			Spaces.Index = AddSpace('/');
		});
	}
815732
@Check
	public void checkSpaceUse(SarlSpace space) {
		error(MessageFormat.format(
				Messages.SARLValidator_0,
				this.grammarAccess.getSpaceKeyword()),
				space,
				null);
	}
888134
public Schema load(KSMetaData keyspaceDef)
    {
        for (CFMetaData cfm : keyspaceDef.cfMetaData().values())
            load(cfm);

        setKeyspaceDefinition(keyspaceDef);

        return this;
    }
27345
private static void getTreeFormat(StringBuffer sb, Event event, Boolean includeContextInfo,
			int noOfTabs, long currentNanoTime, int spacesRequiredForDuration) {
		//Defect 166820
		//Check for events that got added after we started dumping the tree.
		//We ignore these events.
		if(currentNanoTime < event.getStartTime()){
			return;
		}
		
		String executionTimeStr = getExecutionTimeStringFormat(currentNanoTime,
				event); // Convert the execution time into string with 3 decimal
						// places..
		try {
			/**
			 * If its root event add header to table and set the
			 * spacesRequiredForDuration field
			 */
			if (event.getParentEvent() == null) {
				if (spacesRequiredForDuration == 0)
					spacesRequiredForDuration = executionTimeStr.length() + 5;
				sb.append(appendHeader(event, executionTimeStr));
			}
			// Append the execution time
			if (event.getEndTime() == 0) {
				sb.append(String.format(
						"%n%" + spacesRequiredForDuration + "s",
						executionTimeStr + "ms + "));
			} else {
				sb.append(String.format(
						"%n%" + spacesRequiredForDuration + "s",
						executionTimeStr + "ms   "));
			}

			// Append tabs for Child Events
			if (event.getParentEvent() != null) {
				for (int i = 0; i < noOfTabs; i++) {
					sb.append("    ");
				}
			}

			// Append Type + Context information to string...
			if (includeContextInfo && event.getContextInfo() != null) {
				sb.append(event.getType()
						+ RequestProbeConstants.EVENT_CONTEXT_INFO_SEPARATOR
						+ event.getContextInfo());
			} else {
				sb.append(event.getType());
			}

			//Iterating using indices instead of the list iterator to avoid ConcurrentModificationException
			//It is safe to do it this way as we only add elements to the list
			List<Event> list = event.getChildEvents();
			for(int i = 0; i < list.size(); i++){
				//Defect 165134
				//for (Event eventChild : event.getChildEvents()) {
				// Call recursively for child events ..
				getTreeFormat(sb, list.get(i), includeContextInfo, noOfTabs + 1, currentNanoTime,
						spacesRequiredForDuration);
			}
		} catch (Exception e) {

			FFDCFilter.processException(e, EventStackFormatter.class.getName(),
					"94", event);
		}
	}
615641
function loadFileAsString(path, replaceWhiteSpaces){

	var file = new java.io.File(path);
	var fr = new java.io.FileReader(file);
	var br = new java.io.BufferedReader(fr);

	var line;
	var lines = "";

	while((line = br.readLine()) != null){

		if(replaceWhiteSpaces){

			lines = lines + line.replace(" ", "");

		}else{

			lines = lines + line;
		}
	}

	return lines;
}
1268164
private Matrix loadText(InputStream fileStream) throws IOException {
        Matrix matrix = null;

        BufferedReader br = 
                new BufferedReader(new InputStreamReader(fileStream));
        String line = br.readLine();
        if (line == null)
            throw new IOException("Empty .sspace file");
            // Strip off the 4-byte (2 char) header
        String[] dimensions = line.split("\\s");
        int rows = Integer.parseInt(dimensions[0]);
        int columns = Integer.parseInt(dimensions[1]);
        int index = 0;
        
        // reusable array for writing rows into the matrix
        double[] row = new double[columns];
        
        matrix = new ArrayMatrix(rows, columns);

        while ((line = br.readLine()) != null) {
            if (index >= rows)
                throw new IOException("More rows than specified");
            String[] termVectorPair = line.split("\\|");
            String[] values = termVectorPair[1].split("\\s");
            termToIndex.put(termVectorPair[0], index);
            if (values.length != columns) {
                throw new IOException(
                            "improperly formated semantic space file");
            }
            for (int c = 0; c < columns; ++c) {
                double d = Double.parseDouble(values[c]);
                row[c] = d;
                // matrix.set(index, c, d);
            }
            matrix.setRow(index, row);
            index++;
        }
        if (index != rows)
            throw new IOException(String.format(
                "Expected %d rows; saw %d", rows, index));
        return matrix;    
    }
459216
@UserFunction( "apoc.temporal.format" )
    @Description( "apoc.temporal.format(input, format) | Format a temporal value" )
    public String format(
            @Name( "temporal" ) Object input,
            @Name( value = "format", defaultValue = "yyyy-MM-dd") String format
    ) {

        try {
            DateTimeFormatter formatter = getOrCreate(format);

            if (input instanceof LocalDate) {
                return ((LocalDate) input).format(formatter);
            } else if (input instanceof ZonedDateTime) {
                return ((ZonedDateTime) input).format(formatter);
            } else if (input instanceof LocalDateTime) {
                return ((LocalDateTime) input).format(formatter);
            } else if (input instanceof LocalTime) {
                return ((LocalTime) input).format(formatter);
            } else if (input instanceof OffsetTime) {
                return ((OffsetTime) input).format(formatter);
            } else if (input instanceof DurationValue) {
                return formatDuration(input, format);
            }
        } catch (Exception e){
            throw new RuntimeException("Available formats are:\n" +
                    String.join("\n", getTypes()) +
                    "\nSee also: https://www.elastic.co/guide/en/elasticsearch/reference/5.5/mapping-date-format.html#built-in-date-formats " +
                    "and https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html");
        }
        return input.toString();
    }
415645
public Namespace createNamespace(Namespace namespace) throws IOException, TokenExpiredException {
        String requestUrl = RESOURCE;
        ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.POST, requestUrl, namespace);

        assertValidResponse(response, requestUrl);
        return fromJson(response.getResult(), Namespace.class);
    }
825486
public void load(File authorizationFile) throws AuthorizationFileException {
        FileInputStream fis = null;
        try {
            fis = new FileInputStream(authorizationFile);
            ANTLRInputStream stream = new ANTLRInputStream(fis);
            SAFPLexer lexer = new SAFPLexer(stream);
            CommonTokenStream tokens = new CommonTokenStream(lexer);
            SAFPParser parser = new SAFPParser(tokens);
            parser.prog();
            setAccessRules(parser.getAccessRules());
            setGroups(parser.getGroups());
            setAliases(parser.getAliases());
        } catch (FileNotFoundException e) {
            throw new AuthorizationFileException("FileNotFoundException: ", e);
        } catch (IOException e) {
            throw new AuthorizationFileException("IOException: ", e);
        } catch (RecognitionException e) {
            throw new AuthorizationFileException("Parser problem: ", e);
        } finally {
            try {
                fis.close();
            } catch (IOException e) {
                throw new AuthorizationFileException("IOExcetion during close: ", e);
            }
        }
    }
1215930
static public String getSFTimeAsString(
      SFTime sft, int scale, SnowflakeDateTimeFormat timeFormatter)
  {
    return timeFormatter.format(sft, scale);
  }
570040
protected LinkedHashMap<Pattern, String> load(File propertyFile) {
    LinkedHashMap<Pattern, String> result = new LinkedHashMap<Pattern, String>();
    BufferedReader reader = null;
    try {
      reader =
          new BufferedReader(new InputStreamReader(new FileInputStream(propertyFile), "UTF-8"));
      String line;
      while ((line = reader.readLine()) != null) {
        if (line.length() == 0) {
          continue;
        }
        char firstChar = line.charAt(0);
        if (firstChar == '#' || firstChar == '!') {
          continue;
        }
        int pos = line.indexOf('=');
        if (pos < 0) {
          continue;
        }
        String key = line.substring(0, pos);
        String value = line.substring(pos + 1, line.length());
        int pos2 = line.indexOf('@');
        if (pos2 == 0) {
          key = key.substring(1);
        } else if (pos2 > 0) {
          key = Pattern.quote(key.substring(0, pos2)) + key.substring(pos2);
        }
        result.put(Pattern.compile(key), value);
      }
    } catch (IOException e) {
      throw new GenException(Message.DOMAGEN9001, e, e);
    } finally {
      IOUtil.close(reader);
    }
    return result;
  }
540997
public static Workspace loadWorkspaceFromJson(File file) throws Exception {
        if (file == null) {
            throw new IllegalArgumentException("The path to a JSON file must be specified.");
        } else if (!file.exists()) {
            throw new IllegalArgumentException("The specified JSON file does not exist.");
        }

        return new JsonReader().read(new FileReader(file));
    }