Giter Club home page Giter Club logo

ox's Introduction

IO

Tired of writing 10 lines of java code to do a simple IO operation?

IO.java is a clean, flexible API that does what you want in one line of code.

It's as simple as IO.from(a).to(b)

//Read a file to a String
String data = IO.from(new File("data.txt")).toString();

//Read a file as an Image
BufferedImage img = IO.from(new File("img.png")).toImage();

//Read a URL as Json
Json json = IO.fromURL("http://api.website.com/getFriends").toJson();

Writing data is just as easy.

//Write a String to a File
IO.from("Coding is fun!").to(new File("output.txt"));

//Write an image to a File
IO.from(myImage).to(new File("img.png"));

Json

Here are some examples of the Json API

//parse Json from a String
Json json = new Json(s);

//construct a Json Object
Json json = Json.object()
  .with("name","Kvothe")
  .with("age", 16);
  
//make an array
Json json = Json.array().add("Gold").add("Pearls").add("Diamonds");

//Read some values from a Json object
String name = json.get("name");
int age = json.getInt("age");

//Loop through a Json Array
for(String value : json){
}

A whole lot more

There's a lot more useful stuff in here that I don't have time to document yet. But check out Utils.java and just browse through some of the other files.

ox's People

Contributors

mirraj2 avatar mazerakham avatar ksmalik1 avatar amogiska avatar elliottburris avatar yuanz80ender avatar overbalance avatar jzimmerman95 avatar st5703 avatar mikhail-ender avatar

Stargazers

 avatar Kalle avatar Qitao avatar DC avatar Josscoder avatar  avatar Lev Koporushkin avatar gurpal2000 avatar Abhay avatar Tbsc avatar  avatar Vikram Dutt avatar Angelos Kapsimanis avatar Alan Kash avatar Matthew Ring avatar  avatar

Watchers

DC avatar James Cloos avatar  avatar Afik avatar Jose M Leon avatar  avatar  avatar

ox's Issues

Sum should handle longs

Not sure whether generic types make this impossible, but it would be better if Functions.sum(Iterable collection, Function<T, Long> function) would return a long rather than a double.

JSON prettyprint improvement

json.prettyPrint is of limited use for viewing arrays because it formats them like this:

[
  1.3,
  2.7,
  -3.9
  ...
]

IMO, arrays of primitives should be rendered in a single line. Arrays of JSON objects should still be spread out over newlines, of course.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.