GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — lmdbjava/src/main/java/org/lmdbjava/ByteUnit.java at master · lmdbjava/lmdbjava Expand file tree/ Copy pathByteUnit.javaMore file actions 71 lines (63 loc) · 1.98 KB / Copy pathByteUnit.javaFile metadata and controls71 lines (63 loc) · 1.98 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 /* * Copyright © 2016-2025 The LmdbJava Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.lmdbjava; /** Simple {@link Enum} for converting various IEC and SI byte units down to a number of bytes. */ public enum ByteUnit { /** IEC/SI byte unit for bytes. */ BYTES(1L), /** IEC byte unit for 1024 bytes. */ KIBIBYTES(1_024L), /** IEC byte unit for 1024^2 bytes. */ MEBIBYTES(1_048_576L), /** IEC byte unit for 1024^3 bytes. */ GIBIBYTES(1_073_741_824L), /** IEC byte unit for 1024^4 bytes. */ TEBIBYTES(1_099_511_627_776L), /** IEC byte unit for 1024^5 bytes. */ PEBIBYTES(1_125_899_906_842_624L), /** SI byte unit for 1000 bytes. */ KILOBYTES(1_000L), /** SI byte unit for 1000^2 bytes. */ MEGABYTES(1_000_000L), /** SI byte unit for 1000^3 bytes. */ GIGABYTES(1_000_000_000L), /** SI byte unit for 1000^4 bytes. */ TERABYTES(1_000_000_000_000L), /** SI byte unit for 1000^5 bytes. */ PETABYTES(1_000_000_000_000_000L), ; private final long factor; ByteUnit(long factor) { this.factor = factor; } /** * Convert the value in this byte unit into bytes. * * @param value The value to convert. * @return The number of bytes. */ public long toBytes(final long value) { return value * factor; } /** * Gets factor to apply when converting this unit into bytes. * * @return The factor to apply when converting this unit into bytes. */ public long getFactor() { return factor; } } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |