Examples of Bytes


Examples of org.apache.wicket.util.lang.Bytes

    Assert.assertTrue(Bytes.bytes(1024).equals(Bytes.kilobytes(1)));
    Assert.assertTrue(Bytes.bytes(1024 * 1024).equals(Bytes.megabytes(1)));
    Assert.assertTrue("1G".equals(Bytes.gigabytes(1).toString()));


    final Bytes b = Bytes.kilobytes(7.3);

    Assert.assertTrue(b.equals(Bytes.kilobytes(7.3)));
    Assert.assertTrue(b.greaterThan(Bytes.kilobytes(7.25)));
    Assert.assertTrue(b.lessThan(Bytes.kilobytes(7.9)));
    Assert.assertTrue(Bytes.valueOf(b.toString()).equals(b));
  }
View Full Code Here

Examples of org.apache.wicket.util.lang.Bytes

  {
    Locale.setDefault(Locale.UK);
    Assert.assertTrue("1G".equals(Bytes.gigabytes(1).toString()));
    Assert.assertTrue(Bytes.valueOf("15.5K").bytes() == ((15 * 1024) + 512));

    final Bytes b = Bytes.kilobytes(7.3);

    Assert.assertTrue(Bytes.valueOf(b.toString()).equals(b));
  }
View Full Code Here

Examples of org.apache.wicket.util.lang.Bytes

  {
    Locale.setDefault(Locale.GERMANY);
    Assert.assertTrue("1G".equals(Bytes.gigabytes(1).toString()));
    Assert.assertTrue(Bytes.valueOf("15,5K").bytes() == ((15 * 1024) + 512));

    final Bytes b = Bytes.kilobytes(7.3);

    Assert.assertTrue(Bytes.valueOf(b.toString()).equals(b));
  }
View Full Code Here

Examples of org.apache.wicket.util.lang.Bytes

  {
    Assert.assertTrue("1G".equals(Bytes.gigabytes(1).toString()));
    Assert.assertTrue("1,5G".equals(Bytes.gigabytes(1.5).toString(Locale.GERMAN)));
    Assert.assertTrue("1.5G".equals(Bytes.gigabytes(1.5).toString(Locale.US)));

    final Bytes b = Bytes.kilobytes(7.3);
    Assert.assertEquals(b, Bytes.valueOf(b.toString(Locale.GERMAN), Locale.GERMAN));

    Assert.assertTrue(Bytes.valueOf("15,5K", Locale.GERMAN).bytes() == ((15 * 1024) + 512));
    Assert.assertTrue(Bytes.valueOf("15.5K", Locale.US).bytes() == ((15 * 1024) + 512));
  }
View Full Code Here

Examples of org.apache.wicket.util.lang.Bytes

  }

  protected IDataStore newDataStore()
  {
    IStoreSettings storeSettings = getStoreSettings();
    Bytes maxSizePerSession = storeSettings.getMaxSizePerSession();
    File fileStoreFolder = storeSettings.getFileStoreFolder();

    return new DiskDataStore(application.getName(), fileStoreFolder, maxSizePerSession);
  }
View Full Code Here

Examples of org.apache.wicket.util.lang.Bytes

  public void testLastModifiedForResourceInJar() throws IOException
  {
    String anyClassInJarFile = "/java/lang/String.class";
    URL url = getClass().getResource(anyClassInJarFile);
    UrlResourceStream stream = new UrlResourceStream(url);
    Bytes length = stream.length();
    stream.lastModifiedTime();
    assertEquals(stream.length(), length);
    stream.close();
  }
View Full Code Here

Examples of org.apache.wicket.util.lang.Bytes

   *
   * @return the maximum size
   */
  public Bytes getMaxSize()
  {
    Bytes maxSize = this.maxSize;
    if (maxSize == null)
    {
      maxSize = (Bytes)visitChildren(Form.class, new IVisitor<Form<?>>()
      {

        public Object component(Form<?> component)
        {
          Bytes maxSize = component.getMaxSize();
          if (maxSize != null)
          {
            return maxSize;
          }
          return CONTINUE_TRAVERSAL;
View Full Code Here

Examples of org.apache.wicket.util.lang.Bytes

   *
   * @return the maximum size
   */
  public Bytes getMaxSize()
  {
    Bytes maxSize = this.maxSize;
    if (maxSize == null)
    {
      maxSize = (Bytes)visitChildren(Form.class, new IVisitor<Form<?>>()
      {

        public Object component(Form<?> component)
        {
          Bytes maxSize = component.getMaxSize();
          if (maxSize != null)
          {
            return maxSize;
          }
          return CONTINUE_TRAVERSAL;
View Full Code Here

Examples of org.apache.wicket.util.lang.Bytes

  }

  protected IDataStore newDataStore()
  {
    IStoreSettings storeSettings = getStoreSettings();
    Bytes maxSizePerSession = storeSettings.getMaxSizePerSession();
    int fileChannelPoolCapacity = storeSettings.getFileChannelPoolCapacity();
    File fileStoreFolder = storeSettings.getFileStoreFolder();

    return new DiskDataStore(application.getName(), fileStoreFolder, maxSizePerSession,
      fileChannelPoolCapacity);
View Full Code Here

Examples of org.apache.wicket.util.lang.Bytes

  {
    Assert.assertTrue(Bytes.bytes(1024).equals(Bytes.kilobytes(1)));
    Assert.assertTrue(Bytes.bytes(1024 * 1024).equals(Bytes.megabytes(1)));
    Assert.assertTrue("1G".equals(Bytes.gigabytes(1).toString()));

    final Bytes b = Bytes.kilobytes(7.3);

    Assert.assertTrue(b.equals(Bytes.kilobytes(7.3)));
    Assert.assertTrue(b.greaterThan(Bytes.kilobytes(7.25)));
    Assert.assertTrue(b.lessThan(Bytes.kilobytes(7.9)));
    Assert.assertTrue(Bytes.valueOf(b.toString()).equals(b));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.