mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-19 16:59:51 +00:00
Guava: Use Charsets constants.
This commit is contained in:
parent
353e5815c7
commit
806100c868
28 changed files with 97 additions and 48 deletions
|
@ -44,6 +44,8 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
import org.xmlpull.v1.XmlPullParserException;
|
||||
import org.xmlpull.v1.XmlPullParserFactory;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Departure;
|
||||
import de.schildbach.pte.dto.Fare;
|
||||
import de.schildbach.pte.dto.Fare.Type;
|
||||
|
@ -92,7 +94,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
private boolean needsSpEncId = false;
|
||||
private boolean includeRegionId = true;
|
||||
private boolean useProxFootSearch = true;
|
||||
private Charset requestUrlEncoding = ISO_8859_1;
|
||||
private Charset requestUrlEncoding = Charsets.ISO_8859_1;
|
||||
private String httpReferer = null;
|
||||
private String httpRefererTrip = null;
|
||||
private boolean httpPost = false;
|
||||
|
@ -259,7 +261,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
// System.out.println(uri);
|
||||
// System.out.println(parameters);
|
||||
|
||||
final CharSequence page = ParserUtils.scrape(uri.toString(), httpPost ? parameters.substring(1) : null, UTF_8);
|
||||
final CharSequence page = ParserUtils.scrape(uri.toString(), httpPost ? parameters.substring(1) : null, Charsets.UTF_8);
|
||||
final ResultHeader header = new ResultHeader(SERVER_PRODUCT);
|
||||
|
||||
try
|
||||
|
|
|
@ -48,6 +48,8 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
import org.xmlpull.v1.XmlPullParserException;
|
||||
import org.xmlpull.v1.XmlPullParserFactory;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Departure;
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
|
@ -151,7 +153,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
|
||||
public AbstractHafasProvider(final String stationBoardEndpoint, final String getStopEndpoint, final String queryEndpoint, final int numProductBits)
|
||||
{
|
||||
this(stationBoardEndpoint, getStopEndpoint, queryEndpoint, numProductBits, ISO_8859_1);
|
||||
this(stationBoardEndpoint, getStopEndpoint, queryEndpoint, numProductBits, Charsets.ISO_8859_1);
|
||||
}
|
||||
|
||||
public AbstractHafasProvider(final String stationBoardEndpoint, final String getStopEndpoint, final String queryEndpoint,
|
||||
|
@ -507,7 +509,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
try
|
||||
{
|
||||
// work around unparsable XML
|
||||
reader = new StringReplaceReader(new InputStreamReader(ParserUtils.scrapeInputStream(uri), ISO_8859_1), " & ", " & ");
|
||||
reader = new StringReplaceReader(new InputStreamReader(ParserUtils.scrapeInputStream(uri), Charsets.ISO_8859_1), " & ", " & ");
|
||||
reader.replace("<b>", " ");
|
||||
reader.replace("</b>", " ");
|
||||
reader.replace("<u>", " ");
|
||||
|
@ -887,7 +889,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
final String endpoint = extXmlEndpoint != null ? extXmlEndpoint : queryEndpoint;
|
||||
final InputStream is = ParserUtils.scrapeInputStream(endpoint, request, null, null, sessionCookieName);
|
||||
firstChars = ParserUtils.peekFirstChars(is);
|
||||
reader = new InputStreamReader(is, ISO_8859_1);
|
||||
reader = new InputStreamReader(is, Charsets.ISO_8859_1);
|
||||
|
||||
final XmlPullParserFactory factory = XmlPullParserFactory.newInstance(System.getProperty(XmlPullParserFactory.PROPERTY_NAME), null);
|
||||
final XmlPullParser pp = factory.newPullParser();
|
||||
|
@ -1383,8 +1385,8 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
{
|
||||
uri.append("?start=Suchen");
|
||||
|
||||
uri.append("&REQ0JourneyStopsS0ID=").append(ParserUtils.urlEncode(locationId(from), ISO_8859_1));
|
||||
uri.append("&REQ0JourneyStopsZ0ID=").append(ParserUtils.urlEncode(locationId(to), ISO_8859_1));
|
||||
uri.append("&REQ0JourneyStopsS0ID=").append(ParserUtils.urlEncode(locationId(from), Charsets.ISO_8859_1));
|
||||
uri.append("&REQ0JourneyStopsZ0ID=").append(ParserUtils.urlEncode(locationId(to), Charsets.ISO_8859_1));
|
||||
|
||||
if (via != null)
|
||||
{
|
||||
|
@ -1402,11 +1404,11 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
uri.append("&REQ0JourneyStops1.0Y=").append(via.lat);
|
||||
if (via.name == null)
|
||||
uri.append("&REQ0JourneyStops1.0O=").append(
|
||||
ParserUtils.urlEncode(String.format(Locale.ENGLISH, "%.6f, %.6f", via.lat / 1E6, via.lon / 1E6), ISO_8859_1));
|
||||
ParserUtils.urlEncode(String.format(Locale.ENGLISH, "%.6f, %.6f", via.lat / 1E6, via.lon / 1E6), Charsets.ISO_8859_1));
|
||||
}
|
||||
else if (via.name != null)
|
||||
{
|
||||
uri.append("&REQ0JourneyStops1.0G=").append(ParserUtils.urlEncode(via.name, ISO_8859_1));
|
||||
uri.append("&REQ0JourneyStops1.0G=").append(ParserUtils.urlEncode(via.name, Charsets.ISO_8859_1));
|
||||
if (via.type != LocationType.ANY)
|
||||
uri.append('!');
|
||||
}
|
||||
|
@ -2155,7 +2157,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
|
||||
private static class StringTable
|
||||
{
|
||||
private Charset encoding = Charset.forName("ASCII");
|
||||
private Charset encoding = Charsets.US_ASCII;
|
||||
private final byte[] table;
|
||||
|
||||
public StringTable(final DataInputStream is, final int stringTablePtr, final int length) throws IOException
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
package de.schildbach.pte;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
@ -37,8 +36,6 @@ import de.schildbach.pte.dto.Style;
|
|||
*/
|
||||
public abstract class AbstractNetworkProvider implements NetworkProvider
|
||||
{
|
||||
protected static final Charset UTF_8 = Charset.forName("UTF-8");
|
||||
protected static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
|
||||
protected static final Set<Product> ALL_EXCEPT_HIGHSPEED;
|
||||
|
||||
protected TimeZone timeZone = TimeZone.getTimeZone("CET");
|
||||
|
|
|
@ -37,6 +37,8 @@ import org.json.JSONArray;
|
|||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
|
@ -200,12 +202,12 @@ public abstract class AbstractTsiProvider extends AbstractNetworkProvider
|
|||
{
|
||||
final StringBuilder parameters = buildCommonRequestParams("SearchTripPoint", "json");
|
||||
parameters.append("&MaxItems=").append(50); // XXX good value?
|
||||
parameters.append("&Keywords=").append(ParserUtils.urlEncode(constraint.toString(), UTF_8));
|
||||
parameters.append("&Keywords=").append(ParserUtils.urlEncode(constraint.toString(), Charsets.UTF_8));
|
||||
|
||||
final StringBuilder uri = new StringBuilder(stopFinderEndpoint);
|
||||
uri.append(parameters);
|
||||
|
||||
final CharSequence page = ParserUtils.scrape(uri.toString(), null, UTF_8);
|
||||
final CharSequence page = ParserUtils.scrape(uri.toString(), null, Charsets.UTF_8);
|
||||
try
|
||||
{
|
||||
final List<SuggestedLocation> locations = new ArrayList<SuggestedLocation>();
|
||||
|
@ -295,7 +297,7 @@ public abstract class AbstractTsiProvider extends AbstractNetworkProvider
|
|||
final StringBuilder uri = new StringBuilder(stopFinderEndpoint);
|
||||
uri.append(parameters);
|
||||
|
||||
final CharSequence page = ParserUtils.scrape(uri.toString(), null, UTF_8);
|
||||
final CharSequence page = ParserUtils.scrape(uri.toString(), null, Charsets.UTF_8);
|
||||
try
|
||||
{
|
||||
|
||||
|
@ -339,7 +341,7 @@ public abstract class AbstractTsiProvider extends AbstractNetworkProvider
|
|||
final StringBuilder uri = new StringBuilder(stopFinderEndpoint);
|
||||
uri.append(parameters);
|
||||
|
||||
final CharSequence page = ParserUtils.scrape(uri.toString(), null, UTF_8);
|
||||
final CharSequence page = ParserUtils.scrape(uri.toString(), null, Charsets.UTF_8);
|
||||
try
|
||||
{
|
||||
final JSONObject head = new JSONObject(page.toString());
|
||||
|
@ -747,11 +749,11 @@ public abstract class AbstractTsiProvider extends AbstractNetworkProvider
|
|||
parameters.append("&WalkSpeed=").append(walkSpeedStr);
|
||||
|
||||
if (mode != null)
|
||||
parameters.append("&Modes=").append(ParserUtils.urlEncode(mode.toString(), UTF_8));
|
||||
parameters.append("&Modes=").append(ParserUtils.urlEncode(mode.toString(), Charsets.UTF_8));
|
||||
|
||||
final StringBuilder uri = new StringBuilder(tripEndpoint);
|
||||
uri.append(parameters);
|
||||
final CharSequence page = ParserUtils.scrape(uri.toString(), null, UTF_8, null);
|
||||
final CharSequence page = ParserUtils.scrape(uri.toString(), null, Charsets.UTF_8, null);
|
||||
try
|
||||
{
|
||||
final JSONObject head = new JSONObject(page.toString());
|
||||
|
|
|
@ -22,6 +22,8 @@ import java.util.Collection;
|
|||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -46,7 +48,7 @@ public class BayernProvider extends AbstractEfaProvider
|
|||
{
|
||||
super(API_BASE, DEPARTURE_MONITOR_ENDPOINT, TRIP_ENDPOINT, STOP_FINDER_ENDPOINT, null);
|
||||
|
||||
setRequestUrlEncoding(UTF_8);
|
||||
setRequestUrlEncoding(Charsets.UTF_8);
|
||||
setIncludeRegionId(false);
|
||||
setNumTripsRequested(12);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ import java.util.Map;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Line.Attr;
|
||||
import de.schildbach.pte.dto.Point;
|
||||
|
@ -41,7 +43,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
|
||||
public BvgProvider()
|
||||
{
|
||||
super(API_BASE_STATION_BOARD + "stboard.exe/dn", API_BASE + "ajax-getstop.bin/dny", API_BASE + "query.bin/dn", 8, UTF_8);
|
||||
super(API_BASE_STATION_BOARD + "stboard.exe/dn", API_BASE + "ajax-getstop.bin/dny", API_BASE + "query.bin/dn", 8, Charsets.UTF_8);
|
||||
|
||||
setJsonGetStopsUseWeight(false);
|
||||
setStyles(STYLES);
|
||||
|
|
|
@ -31,6 +31,8 @@ import java.util.Set;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Departure;
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
|
@ -59,7 +61,7 @@ public class InvgProvider extends AbstractHafasProvider
|
|||
|
||||
public InvgProvider()
|
||||
{
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 10, UTF_8);
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 10, Charsets.UTF_8);
|
||||
|
||||
setStationBoardCanDoEquivs(false);
|
||||
setStyles(STYLES);
|
||||
|
|
|
@ -21,6 +21,8 @@ import java.io.IOException;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
|
@ -39,7 +41,7 @@ public class JetProvider extends AbstractHafasProvider
|
|||
|
||||
public JetProvider()
|
||||
{
|
||||
super(API_BASE + "stboard.bin/yn", API_BASE + "ajax-getstop.bin/yn", API_BASE + "query.bin/yn", 4, UTF_8);
|
||||
super(API_BASE + "stboard.bin/yn", API_BASE + "ajax-getstop.bin/yn", API_BASE + "query.bin/yn", 4, Charsets.UTF_8);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
|
|
@ -19,6 +19,8 @@ package de.schildbach.pte;
|
|||
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Product;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +33,7 @@ public class LuProvider extends AbstractHafasProvider
|
|||
|
||||
public LuProvider()
|
||||
{
|
||||
super(API_BASE + "stboard.exe/fn", API_BASE + "ajax-getstop.exe/fn", API_BASE + "query.exe/fn", 9, UTF_8);
|
||||
super(API_BASE + "stboard.exe/fn", API_BASE + "ajax-getstop.exe/fn", API_BASE + "query.exe/fn", 9, Charsets.UTF_8);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
|
|
@ -20,6 +20,8 @@ package de.schildbach.pte;
|
|||
import java.io.IOException;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -36,7 +38,7 @@ public class NasaProvider extends AbstractHafasProvider
|
|||
|
||||
public NasaProvider()
|
||||
{
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 8, UTF_8);
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 8, Charsets.UTF_8);
|
||||
|
||||
setStationBoardHasLocation(true);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ import java.util.Collection;
|
|||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.Product;
|
||||
import de.schildbach.pte.dto.QueryTripsContext;
|
||||
|
@ -39,7 +41,7 @@ public class NriProvider extends AbstractHafasProvider
|
|||
{
|
||||
super(API_BASE + "stboard.exe/on", API_BASE + "ajax-getstop.exe/ony", API_BASE + "query.exe/on", 8);
|
||||
|
||||
setJsonGetStopsEncoding(UTF_8);
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
|
|
@ -20,6 +20,8 @@ package de.schildbach.pte;
|
|||
import java.io.IOException;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -36,7 +38,7 @@ public class NvvProvider extends AbstractHafasProvider
|
|||
|
||||
public NvvProvider()
|
||||
{
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 12, UTF_8);
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 12, Charsets.UTF_8);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
|
|
@ -21,6 +21,8 @@ import java.io.IOException;
|
|||
import java.util.Collection;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -39,7 +41,7 @@ public class OebbProvider extends AbstractHafasProvider
|
|||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dny", API_BASE + "query.exe/dn", 13);
|
||||
|
||||
setDominantPlanStopTime(true);
|
||||
setJsonGetStopsEncoding(UTF_8);
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
|
|
@ -19,6 +19,8 @@ package de.schildbach.pte;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Product;
|
||||
import de.schildbach.pte.util.StringReplaceReader;
|
||||
|
||||
|
@ -32,7 +34,7 @@ public class PlProvider extends AbstractHafasProvider
|
|||
|
||||
public PlProvider()
|
||||
{
|
||||
super(API_BASE + "stboard.exe/pn", API_BASE + "ajax-getstop.exe/pn", API_BASE + "query.exe/pn", 7, UTF_8);
|
||||
super(API_BASE + "stboard.exe/pn", API_BASE + "ajax-getstop.exe/pn", API_BASE + "query.exe/pn", 7, Charsets.UTF_8);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
|
|
@ -22,6 +22,8 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Product;
|
||||
import de.schildbach.pte.dto.Style;
|
||||
import de.schildbach.pte.dto.Style.Shape;
|
||||
|
@ -36,7 +38,7 @@ public class RsagProvider extends AbstractHafasProvider
|
|||
|
||||
public RsagProvider()
|
||||
{
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 10, UTF_8);
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 10, Charsets.UTF_8);
|
||||
|
||||
setStyles(STYLES);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ package de.schildbach.pte;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Product;
|
||||
|
||||
/**
|
||||
|
@ -31,9 +33,9 @@ public class RtProvider extends AbstractHafasProvider
|
|||
|
||||
public RtProvider()
|
||||
{
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 10, UTF_8);
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 10, Charsets.UTF_8);
|
||||
|
||||
setJsonNearbyStationsEncoding(ISO_8859_1);
|
||||
setJsonNearbyStationsEncoding(Charsets.ISO_8859_1);
|
||||
setStationBoardHasStationTable(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@ import java.util.Collection;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Product;
|
||||
|
||||
|
@ -37,7 +39,7 @@ public class SeProvider extends AbstractHafasProvider
|
|||
|
||||
public SeProvider()
|
||||
{
|
||||
super(API_BASE + "stboard.exe/sn", API_BASE + "ajax-getstop.exe/sny", API_BASE + "query.exe/sn", 14, UTF_8);
|
||||
super(API_BASE + "stboard.exe/sn", API_BASE + "ajax-getstop.exe/sny", API_BASE + "query.exe/sn", 14, Charsets.UTF_8);
|
||||
|
||||
setClientType("ANDROID");
|
||||
setUseIso8601(true);
|
||||
|
|
|
@ -27,6 +27,8 @@ import java.util.List;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Departure;
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
|
@ -52,7 +54,7 @@ public class ShProvider extends AbstractHafasProvider
|
|||
|
||||
public ShProvider()
|
||||
{
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 10, UTF_8);
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 10, Charsets.UTF_8);
|
||||
|
||||
setStationBoardCanDoEquivs(false);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ import java.io.IOException;
|
|||
import java.util.Collection;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -38,8 +40,8 @@ public class SncbProvider extends AbstractHafasProvider
|
|||
{
|
||||
super(API_BASE + "stboard.exe/nn", API_BASE + "ajax-getstop.exe/nny", API_BASE + "query.exe/nn", 16);
|
||||
|
||||
setJsonGetStopsEncoding(UTF_8);
|
||||
setJsonNearbyStationsEncoding(UTF_8);
|
||||
setJsonGetStopsEncoding(Charsets.UTF_8);
|
||||
setJsonNearbyStationsEncoding(Charsets.UTF_8);
|
||||
setStationBoardHasLocation(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ import java.util.Set;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Product;
|
||||
|
||||
|
@ -44,7 +46,7 @@ public class VbbProvider extends AbstractHafasProvider
|
|||
|
||||
public VbbProvider()
|
||||
{
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 7, UTF_8);
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 7, Charsets.UTF_8);
|
||||
|
||||
setJsonGetStopsUseWeight(false);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package de.schildbach.pte;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Product;
|
||||
|
||||
/**
|
||||
|
@ -29,7 +31,7 @@ public class VbnProvider extends AbstractHafasProvider
|
|||
|
||||
public VbnProvider()
|
||||
{
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dny", API_BASE + "query.exe/dn", 10, UTF_8);
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dny", API_BASE + "query.exe/dn", 10, Charsets.UTF_8);
|
||||
|
||||
setStationBoardHasStationTable(true);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ package de.schildbach.pte;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Style;
|
||||
|
||||
/**
|
||||
|
@ -40,7 +42,7 @@ public class VorProvider extends AbstractEfaProvider
|
|||
setHttpPost(true);
|
||||
setIncludeRegionId(false);
|
||||
setStyles(STYLES);
|
||||
setRequestUrlEncoding(UTF_8);
|
||||
setRequestUrlEncoding(Charsets.UTF_8);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
|
|
@ -20,6 +20,8 @@ package de.schildbach.pte;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Style;
|
||||
|
||||
/**
|
||||
|
@ -39,7 +41,7 @@ public class VrrProvider extends AbstractEfaProvider
|
|||
setNeedsSpEncId(true);
|
||||
setUseRouteIndexAsTripId(false);
|
||||
setStyles(STYLES);
|
||||
setRequestUrlEncoding(UTF_8);
|
||||
setRequestUrlEncoding(Charsets.UTF_8);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
|
|
@ -19,6 +19,8 @@ package de.schildbach.pte;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -34,7 +36,7 @@ public class VsnProvider extends AbstractHafasProvider
|
|||
|
||||
public VsnProvider()
|
||||
{
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 10, UTF_8);
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 10, Charsets.UTF_8);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package de.schildbach.pte;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
/**
|
||||
* @author Andreas Schildbach
|
||||
*/
|
||||
|
@ -36,7 +38,7 @@ public class VvoProvider extends AbstractEfaProvider
|
|||
|
||||
setUseRealtime(false);
|
||||
setUseStringCoordListOutputFormat(false);
|
||||
setRequestUrlEncoding(UTF_8);
|
||||
setRequestUrlEncoding(Charsets.UTF_8);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
|
|
@ -20,6 +20,8 @@ package de.schildbach.pte;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Style;
|
||||
|
||||
/**
|
||||
|
@ -36,7 +38,7 @@ public class WienProvider extends AbstractEfaProvider
|
|||
|
||||
setIncludeRegionId(false);
|
||||
setStyles(STYLES);
|
||||
setRequestUrlEncoding(UTF_8);
|
||||
setRequestUrlEncoding(Charsets.UTF_8);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
|
|
@ -21,6 +21,8 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Product;
|
||||
import de.schildbach.pte.dto.Style;
|
||||
|
@ -36,7 +38,7 @@ public class ZvvProvider extends AbstractHafasProvider
|
|||
|
||||
public ZvvProvider()
|
||||
{
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 10, UTF_8);
|
||||
super(API_BASE + "stboard.exe/dn", API_BASE + "ajax-getstop.exe/dn", API_BASE + "query.exe/dn", 10, Charsets.UTF_8);
|
||||
|
||||
setStyles(STYLES);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import de.schildbach.pte.exception.BlockedException;
|
||||
import de.schildbach.pte.exception.InternalErrorException;
|
||||
import de.schildbach.pte.exception.NotFoundException;
|
||||
|
@ -58,8 +60,6 @@ public final class ParserUtils
|
|||
private static final int SCRAPE_PEEK_SIZE = 4096;
|
||||
private static final int SCRAPE_CONNECT_TIMEOUT = 5000;
|
||||
private static final int SCRAPE_READ_TIMEOUT = 15000;
|
||||
private static final Charset SCRAPE_DEFAULT_ENCODING = Charset.forName("ISO-8859-1");
|
||||
|
||||
private static HttpCookie sessionCookie;
|
||||
|
||||
public static final CharSequence scrape(final String url) throws IOException
|
||||
|
@ -87,7 +87,7 @@ public final class ParserUtils
|
|||
final String authorization) throws IOException
|
||||
{
|
||||
if (requestEncoding == null)
|
||||
requestEncoding = SCRAPE_DEFAULT_ENCODING;
|
||||
requestEncoding = Charsets.ISO_8859_1;
|
||||
|
||||
final StringBuilder buffer = new StringBuilder(SCRAPE_INITIAL_CAPACITY);
|
||||
final InputStream is = scrapeInputStream(urlStr, postRequest, requestEncoding, null, sessionCookieName, authorization);
|
||||
|
@ -130,7 +130,7 @@ public final class ParserUtils
|
|||
final String sessionCookieName, final String authorization) throws IOException
|
||||
{
|
||||
if (requestEncoding == null)
|
||||
requestEncoding = SCRAPE_DEFAULT_ENCODING;
|
||||
requestEncoding = Charsets.ISO_8859_1;
|
||||
|
||||
int tries = 3;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue