List of usage examples for java.lang Long MAX_VALUE
long MAX_VALUE
To view the source code for java.lang Long MAX_VALUE.
Click Source Link
From source file:com.opendoorlogistics.core.utils.strings.Strings.java
/** * Check if the string s is already used and if so, add a number to the end of it (1, 2, 3...) to make it unique * /*from ww w . j a v a2s. c o m*/ * @param s * @return */ public static String makeUnique(String s, DoesStringExist cb) { long l = 0; while (l < Long.MAX_VALUE) { String ret = s + (l == 0 ? "" : Long.toString(l)); if (cb.isExisting(ret) == false) { return ret; } l++; } return null; }
From source file:com.alibaba.ims.platform.util.DateUtil.java
/** * ?//from w ww . j a v a 2 s .c o m * * @param date * @return */ public static long minus(Date date) { if (date == null) { return Long.MAX_VALUE; } return ((date.getTime() - System.currentTimeMillis() - 1) / DateUtils.MILLIS_PER_DAY) + 1; }
From source file:com.zimbra.common.util.BufferStreamRequestEntity.java
public BufferStreamRequestEntity(InputStream is, long sizeHint, int maxBuffer) { this(is, null, sizeHint, maxBuffer, Long.MAX_VALUE); }
From source file:gate.corpora.DocumentContentImpl.java
/** Contruction from URL and offsets. */ public DocumentContentImpl(URL u, String encoding, Long start, Long end) throws IOException { int readLength = 0; char[] readBuffer = new char[INTERNAL_BUFFER_SIZE]; BufferedReader uReader = null; InputStream uStream = null;//from w w w . j a va 2 s . c om StringBuffer buf = new StringBuffer(); long s = 0, e = Long.MAX_VALUE; if (start != null && end != null) { s = start.longValue(); e = end.longValue(); } try { URLConnection conn = u.openConnection(); uStream = conn.getInputStream(); if ("gzip".equals(conn.getContentEncoding())) { uStream = new GZIPInputStream(uStream); } if (encoding != null && !encoding.equalsIgnoreCase("")) { uReader = new BomStrippingInputStreamReader(uStream, encoding, INTERNAL_BUFFER_SIZE); } else { uReader = new BomStrippingInputStreamReader(uStream, INTERNAL_BUFFER_SIZE); } ; // 1. skip S characters uReader.skip(s); // 2. how many character shall I read? long toRead = e - s; // 3. read gtom source into buffer while (toRead > 0 && (readLength = uReader.read(readBuffer, 0, INTERNAL_BUFFER_SIZE)) != -1) { if (toRead < readLength) { //well, if toRead(long) is less than readLenght(int) //then there can be no overflow, so the cast is safe readLength = (int) toRead; } buf.append(readBuffer, 0, readLength); toRead -= readLength; } } finally { // 4.close reader IOUtils.closeQuietly(uReader); IOUtils.closeQuietly(uStream); } content = new String(buf); originalContent = content; }
From source file:com.mcreations.usb.windows.WindowsUsbServices.java
public WindowsUsbServices() throws UsbException { JavaxUsb.initialise(); topologyUpdateManager.setMaxSize(Long.MAX_VALUE); checkProperties(); startTopologyListener(); }
From source file:com.github.nakamurakj.validator.Validators.java
/** * ???/*from w w w. j a v a2 s .co m*/ * * @param string * @param min ?? * @param max ? * @return ??<code>true</code> */ public static boolean isNumberString(String string, int min, int max) { if (string != null && string.length() >= min && string.length() <= max) { try { long value = Long.parseLong(string); return Long.MIN_VALUE <= value && value <= Long.MAX_VALUE; } catch (NumberFormatException e) { // ignore } } return false; }
From source file:com.streamsets.datacollector.util.TestConfiguration.java
@Test public void testBasicMethods() { Configuration conf = new Configuration(); Assert.assertTrue(conf.getNames().isEmpty()); conf.set("s", "S"); conf.set("b", true); conf.set("i", Integer.MAX_VALUE); conf.set("l", Long.MAX_VALUE); Assert.assertTrue(conf.hasName("s")); Assert.assertEquals(ImmutableSet.of("s", "b", "i", "l"), conf.getNames()); Assert.assertEquals("S", conf.get("s", "D")); Assert.assertEquals(true, conf.get("b", false)); Assert.assertEquals(Integer.MAX_VALUE, conf.get("i", 1)); Assert.assertEquals(Long.MAX_VALUE, conf.get("l", 2l)); Assert.assertEquals("D", conf.get("x", "D")); Assert.assertEquals(false, conf.get("x", false)); Assert.assertEquals(1, conf.get("x", 1)); Assert.assertEquals(2l, conf.get("x", 2l)); conf.unset("s"); Assert.assertFalse(conf.hasName("s")); Assert.assertEquals(null, conf.get("s", null)); }
From source file:info.archinnov.achilles.test.integration.tests.NamingStrategyIT.java
@Test public void should_apply_snake_case_naming() throws Exception { //Given//from w ww . j av a 2s.c om Long id = RandomUtils.nextLong(0, Long.MAX_VALUE); EntityWithNamingStrategy entity = new EntityWithNamingStrategy(id, "fn", "ln", "nick"); //When manager.insert(entity); //Then final Row row = session.execute("SELECT * from achilles_test.snake_case_naming WHERE my_id = ?", id).one(); assertThat(row).isNotNull(); assertThat(row.getLong("my_id")).isEqualTo(id); assertThat(row.getString("fn")).isEqualTo("fn"); assertThat(row.getString("last_name")).isEqualTo("ln"); assertThat(row.getString("nickName")).isEqualTo("nick"); //When final EntityWithNamingStrategy found = manager.find(EntityWithNamingStrategy.class, id); //Then assertThat(found.getFirstName()).isEqualTo("fn"); assertThat(found.getLastName()).isEqualTo("ln"); assertThat(found.getNickName()).isEqualTo("nick"); }
From source file:com.netflix.suro.queue.FileQueue4Sink.java
@JsonCreator public FileQueue4Sink(@JsonProperty("path") String path, @JsonProperty("name") String name, @JsonProperty("gcPeriod") String gcPeriod, @JsonProperty("sizeLimit") long sizeLimit) throws IOException { queue = new FileBlockingQueue<Message>(path, name, new Period(gcPeriod == null ? "PT1m" : gcPeriod).toStandardSeconds().getSeconds(), new MessageSerDe(), sizeLimit == 0 ? Long.MAX_VALUE : sizeLimit); }
From source file:com.jivesoftware.os.filer.queue.store.FileQueueImpl.java
public FileQueueImpl(String pathToQueueFiles, String queueName, long takableWhenLastAppendedIsOlderThanXMillis, long takableWhenLargerThanXSize, long maxQueueLength, int pushbackAtQueueSize, boolean deleteQueueFilesOnExit, MutableLong pending, boolean takeFullQueuesOnly) throws IOException { this(pathToQueueFiles, queueName, Long.MAX_VALUE, takableWhenLastAppendedIsOlderThanXMillis, takableWhenLargerThanXSize, maxQueueLength, pushbackAtQueueSize, deleteQueueFilesOnExit, pending, takeFullQueuesOnly);/*from w ww. j a v a 2s . c om*/ }