FreeRDP
Loading...
Searching...
No Matches
ConnectionReference.java
1/*
2 A RDP connection reference. References can use bookmark ids or hostnames to connect to a RDP
3 server.
4
5 Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
6
7 This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
8 If a copy of the MPL was not distributed with this file, You can obtain one at
9 http://mozilla.org/MPL/2.0/.
10*/
11
12package com.freerdp.freerdpcore.domain;
13
15{
16 public static final String PATH_MANUAL_BOOKMARK_ID = "MBMID/";
17 public static final String PATH_HOSTNAME = "HOST/";
18 public static final String PATH_FILE = "FILE/";
19
20 public static String getBookmarkReference(long bookmarkId)
21 {
22 return (PATH_MANUAL_BOOKMARK_ID + bookmarkId);
23 }
24
25 public static String getHostnameReference(String hostname)
26 {
27 return (PATH_HOSTNAME + hostname);
28 }
29
30 public static String getFileReference(String uri)
31 {
32 return (PATH_FILE + uri);
33 }
34
35 public static boolean isBookmarkReference(String refStr)
36 {
37 return refStr.startsWith(PATH_MANUAL_BOOKMARK_ID);
38 }
39
40 public static boolean isHostnameReference(String refStr)
41 {
42 return refStr.startsWith(PATH_HOSTNAME);
43 }
44
45 public static boolean isFileReference(String refStr)
46 {
47 return refStr.startsWith(PATH_FILE);
48 }
49
50 public static long getBookmarkId(String refStr)
51 {
52 return Integer.parseInt(refStr.substring(PATH_MANUAL_BOOKMARK_ID.length()));
53 }
54
55 public static String getHostname(String refStr)
56 {
57 return refStr.substring(PATH_HOSTNAME.length());
58 }
59
60 public static String getFile(String refStr)
61 {
62 return refStr.substring(PATH_FILE.length());
63 }
64}