Example usage for java.lang Integer MAX_VALUE

List of usage examples for java.lang Integer MAX_VALUE

Introduction

In this page you can find the example usage for java.lang Integer MAX_VALUE.

Prototype

int MAX_VALUE

To view the source code for java.lang Integer MAX_VALUE.

Click Source Link

Document

A constant holding the maximum value an int can have, 231-1.

Usage

From source file:com.goncalomb.bukkit.nbteditor.commands.CommandNBTBook.java

@Command(args = "title", type = CommandType.PLAYER_ONLY, minargs = 1, maxargs = Integer.MAX_VALUE, usage = "<title ...>")
public boolean titleCommand(CommandSender sender, String[] args) throws MyCommandException {
    HandItemWrapper.Book item = new HandItemWrapper.Book((Player) sender, BookType.WRITTEN);
    item.meta.setTitle(UtilsMc.parseColors(UtilsMc.parseColors(StringUtils.join(args, " "))));
    item.save();/*from   ww  w. java2 s.co  m*/
    sender.sendMessage("aBook title set.");
    return true;
}

From source file:org.zywx.wbpalmstar.engine.eservice.EServiceTest.java

private static byte[] toByteArray(HttpEntity entity) throws Exception {
    if (entity == null) {
        throw new Exception("HTTP entity may not be null");
    }/*from w  w w .j ava2 s .c  o  m*/
    InputStream instream = entity.getContent();
    if (instream == null) {
        return new byte[] {};
    }
    long len = entity.getContentLength();
    if (len > Integer.MAX_VALUE) {
        throw new Exception("HTTP entity too large to be buffered in memory");
    }
    Header contentEncoding = entity.getContentEncoding();
    boolean gzip = false;
    if (null != contentEncoding) {
        if ("gzip".equalsIgnoreCase(contentEncoding.getValue())) {
            instream = new GZIPInputStream(instream, 2048);
            gzip = true;
        }
    }
    ByteArrayBuffer buffer = new ByteArrayBuffer(1024 * 8);
    // \&:38, \n:10, \r:13, \':39, \":34, \\:92
    try {
        if (gzip) {
            int lenth = 0;
            while (lenth != -1) {
                byte[] buf = new byte[2048];
                try {
                    lenth = instream.read(buf, 0, buf.length);
                    if (lenth != -1) {
                        buffer.append(buf, 0, lenth);
                    }
                } catch (EOFException e) {
                    int tl = buf.length;
                    int surpl;
                    for (int k = 0; k < tl; ++k) {
                        surpl = buf[k];
                        if (surpl != 0) {
                            buffer.append(surpl);
                        }
                    }
                    lenth = -1;
                }
            }
            int bl = buffer.length();
            ByteArrayBuffer temBuffer = new ByteArrayBuffer((int) (bl * 1.4));
            for (int j = 0; j < bl; ++j) {
                int cc = buffer.byteAt(j);
                //               if (cc == 34 || cc == 39 || cc == 92 || cc == 10
                //                     || cc == 13 || cc == 38) {
                //                  temBuffer.append('\\');
                //               }
                temBuffer.append(cc);
            }
            buffer = temBuffer;
        } else {
            int c;
            while ((c = instream.read()) != -1) {
                //               if (c == 34 || c == 39 || c == 92 || c == 10 || c == 13
                //                     || c == 38) {
                //                  buffer.append('\\');
                //               }
                buffer.append(c);
            }
        }
    } catch (Exception e) {
        instream.close();
    } finally {
        instream.close();
    }
    return buffer.toByteArray();
}

From source file:com.zimbra.common.util.BufferStreamRequestEntity.java

public BufferStreamRequestEntity(InputStream is, String contentType, long sizeHint) {
    this(is, contentType, sizeHint, Integer.MAX_VALUE);
}

From source file:io.yields.math.framework.range.IntegerRange.java

private static Integer getIntValue(String value) {
    if (ComparableRange.NEG_INFTY.equals(value)) {
        return Integer.MIN_VALUE;
    }/*  w w w  .j av a2  s  .c  o m*/
    if (ComparableRange.POS_INFTY.equals(value)) {
        return Integer.MAX_VALUE;
    }
    return new Integer(value);
}

From source file:com.gigaspaces.blueprint.frauddetection.processor.UserCheckValidation.java

@SpaceDataEvent
public void validateUser(UserPaymentMsg event, GigaSpace gigaSpace) {

    try {/*ww  w  . java  2  s  .c om*/
        //get the latest copy of user data
        User user = gigaSpace.readById(User.class, event.getUserId(), null, 0, ReadModifiers.READ_COMMITTED);
        //get the latest copy of cards details
        Card cardTemplate = new Card();
        cardTemplate.setUserId(event.getUserId());
        Card[] cards = gigaSpace.readMultiple(cardTemplate, Integer.MAX_VALUE, ReadModifiers.READ_COMMITTED);
        //get all transaction for this user
        Payment paymentTemplate = new Payment();
        paymentTemplate.setUserId(event.getUserId());
        Payment[] payments = gigaSpace.readMultiple(paymentTemplate, Integer.MAX_VALUE,
                ReadModifiers.READ_COMMITTED);

        IdQuery<PaymentAuthorization> idQuery = new IdQuery<PaymentAuthorization>(PaymentAuthorization.class,
                event.getPaymentId());

        Boolean paymentValid = AuthorizeUserData(user, cards, payments);

        gigaSpace.change(idQuery, new ChangeSet().set("userCheck", paymentValid));

    } catch (DataAccessException e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
    }

}

From source file:com.photobucket.api.core.FileBodyWithProgress.java

public FileBodyWithProgress(final File file) {
    super(file);/*from   ww  w .  ja  v  a  2  s  .co  m*/
    filePath = file.getAbsolutePath();

    // Make sure we don't truncate the file size/
    long sizeLong = file.length();

    if (sizeLong > Integer.MAX_VALUE) {
        size = -1;
        logger.error("File size exceeds Integer.MAX_VALUE (" + Integer.MAX_VALUE + ") ");
    } else {
        size = (int) sizeLong;
    }
}

From source file:hudson.plugins.jobConfigHistory.GetDiffLines.java

/**
 * Constructor./*from  w ww . j a va2  s  .c  o  m*/
 *
 * @param diffLines to construct the {@link SideBySideView} for.
 */
public GetDiffLines(List<String> diffLines) {
    final DiffRowGenerator.Builder builder = new DiffRowGenerator.Builder();
    builder.columnWidth(Integer.MAX_VALUE);
    dfg = builder.build();
    this.diffLines = diffLines;
    view = new SideBySideView();
}

From source file:com.indeed.imhotep.web.ResultServlet.java

@RequestMapping("/results/{filename:.+}")
protected void doGet(final HttpServletResponse resp, @PathVariable("filename") String filename,
        @RequestParam(required = false) String view, OutputStream outputStream) throws IOException {
    resp.setHeader("Access-Control-Allow-Origin", "*");
    final boolean csv = filename.endsWith(".csv");
    final boolean avoidFileSave = view != null;

    if (!queryCache.isFileCached(filename)) {
        resp.sendError(404);/*from   w  w  w  . jav a 2s .c  o m*/
        return;
    }

    setContentType(resp, avoidFileSave, csv, false);
    final InputStream cacheInputStream = queryCache.getInputStream(filename);
    IQLQuery.copyStream(cacheInputStream, outputStream, Integer.MAX_VALUE, false);
    outputStream.close();

}

From source file:com.github.lynxdb.server.core.repository.UserRepo.java

public List<User> all() {
    monitor.queryGetCount.incrementAndGet();
    return ct.select(QueryBuilder.select().all().from("users").limit(Integer.MAX_VALUE), User.class);
}

From source file:edu.wisc.hr.demo.RandomTaxStatementDao.java

@Override
public TaxStatements getTaxStatements(String emplid) {

    if (this.emplIdToTaxStatements.containsKey(emplid)) {
        return this.emplIdToTaxStatements.get(emplid);
    }// w  ww  .  j a  v  a  2  s.  c  o  m

    TaxStatements taxStatements = new TaxStatements();

    int howManyTaxStatements = random.nextInt(20);

    for (int i = 0; i < howManyTaxStatements; i++) {

        TaxStatement taxStatement = new TaxStatement();

        taxStatement.setFullTitle("What's a title?");
        taxStatement.setName("What's a name?");

        String randomDocId = Integer.toString(random.nextInt(Integer.MAX_VALUE));
        taxStatement.setDocId(new BigInteger(randomDocId));

        taxStatement.setYear(new BigInteger("2013"));

        taxStatements.getTaxStatements().add(taxStatement);

    }

    this.emplIdToTaxStatements.put(emplid, taxStatements);

    return taxStatements;

}