Comments (3)
Existing APIs:
long readLong();
long readLongLe();
String readUtf8(long byteCount);
Buffer writeLong(long v);
Buffer writeLongLe(long v);
Buffer writeUtf8(String string);
We care about a few things:
- Primitive type. byte, short, int, long. I think we can get away with
long
only, especially since as I understand it, we'll be using that much memory anyway on 64-bit CPUs. - Radix. I think we should do decimal and hexadecimal only. Other radixes aren't common enough to justify being on the fast path, and that way we can put the words decimal and hexadecimal right in the API, instead of using
10
and16
, which read like lengths instead of radixes. - Signed vs. Unsigned. I claim that for decimal we start with signed (only), and for hexadecimal we start with unsigned (only). This is particularly important when writing: what should -1L emit? I think for decimal we want
"-1"
and for hex we want"ffffffffffffffff"
. Signed hexadecimal is particularly weird and I don't think we need it, at least not in the beginning.
That leaves us with four new methods:
long readDecimalLong();
long readHexadecimalUnsignedLong();
Buffer writeDecimalLong(long value);
Buffer writeHexadecimalUnsignedLong(long value);
I admit that the method names are wordy! But it gives us the runway should we go mad and later add readDecimalUnsignedLong
or readHexadecimalLong
.
from okio.
How does readDecimalLong
know when to stop?
from okio.
We keep reading till we see something not in 0..9, or exhaust the stream.
from okio.
Related Issues (20)
- Usage of `kotlin-node` declarations from kotlin-wrappers HOT 1
- Thoughts on using flag `O_CLOEXEC` for unix source sets? HOT 3
- `Closeable.use` throws NPE when `block` returns nullable HOT 1
- How to try okio wasm HOT 1
- M'y github
- IllegalArgumentException when trying to write a file HOT 2
- Add extensions to improve out-of-box experiences HOT 4
- okio.IOException: Operation not permitted. HOT 2
- Issue with folders named like 'X: Something' HOT 1
- Source#readZip() HOT 4
- Question: How do I access FileSystem in wasmJs? HOT 3
- API for File Locking
- API for unwrapping FileSystem HOT 2
- Extension mechanism for FileSystem HOT 4
- Path.relativeTo does not respect 'current directory dot'
- Windows (native build) codepage issues HOT 3
- Is there any API to set last modified time for a file? HOT 4
- Feature Request: support creation of NTFS Junctions HOT 1
- RealBufferedSource.read() with length=0 blocks until there's some data, breaking InputStream.readNBytes HOT 2
- [help] how to efficiently encode and decode custom int using unsafe
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from okio.