Skip to content

Commit 817cf07

Browse files
committed
Commit
1 parent 111dea3 commit 817cf07

1 file changed

Lines changed: 96 additions & 69 deletions

File tree

README.md

Lines changed: 96 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,109 @@
1-
# OpenScan: An Efficient Open-Source Alternative to Java's Scanner
1+
# OpenScan: A More Efficient Scanner for Java 📡
22

3-
**OpenScan is an Open-Source Implementation of Scanner Class in Java but more Efficient.**
3+
![OpenScan](https://img.shields.io/badge/OpenScan-Open%20Source-brightgreen)
44

5-
---
5+
Welcome to the **OpenScan** repository! OpenScan is an open-source implementation of the Scanner class in Java, designed to be more efficient and user-friendly. This project aims to enhance how Java developers handle user input while maintaining simplicity and effectiveness.
66

7-
## Introduction :
7+
## Table of Contents
88

9-
`OpenScan` is a robust, efficient, and versatile Java library designed to replace the standard `Scanner` class for handling user input. While the built-in `Scanner` class is useful for basic tasks, `OpenScan` offers significant advantages in terms of performance, error handling, and flexibility, especially when dealing with large inputs or complex data formats.
9+
- [Features](#features)
10+
- [Installation](#installation)
11+
- [Usage](#usage)
12+
- [Contributing](#contributing)
13+
- [License](#license)
14+
- [Contact](#contact)
15+
- [Releases](#releases)
1016

11-
---
17+
## Features
1218

13-
## Key Features and Advantages :
14-
15-
* **Enhanced Performance:**
16-
* Leverages `BufferedReader` for efficient line-by-line reading.
17-
* Uses buffering to reduce the number of physical read operations, resulting in faster I/O.
18-
* **Line-Oriented Input:**
19-
* `nextLine()` method efficiently reads entire lines, unlike `Scanner`'s token-based approach.
20-
* **Robust Error Handling:**
21-
* Explicitly throws `NoSuchElementException` when input is exhausted.
22-
* Throws `NumberFormatException` for invalid numeric input.
23-
* Throws `RuntimeException` (wrapping `IOException`) for I/O errors.
24-
* Handles empty tokens when `nextChar()` is called.
25-
* **Automatic Resource Management:**
26-
* Implements `AutoCloseable`, allowing for use with try-with-resources, ensuring proper resource cleanup.
27-
* **Comprehensive Data Type Support:**
28-
* Directly reads various data types: `int`, `long`, `double`, `float`, `boolean`, `char`, `short`, `byte`.
29-
* **Array and List Reading:**
30-
* `nextIntArray()`, `nextLongArray()`, `nextDoubleArray()` read multiple values into arrays.
31-
* `nextStringList()` reads all tokens on a line into a `List<String>`.
32-
* **Complete Data Loading:**
33-
* `readAllInts()`, `readAllDoubles()`, `readAllLongs()`, `readAllStrings()` reads all the available data from the input stream.
34-
* **Input Control:**
35-
* `skipLines()` to efficiently skip over unwanted lines of input.
36-
* **Clear tokenizer**
37-
* `nextLine()` method clears the tokenizer by assigning null.
38-
* **Robust Checking**
39-
* `hasNext()` method checks properly if the new token is available.
40-
* **Detailed Exception Handling:**
41-
* It handles all the exceptions clearly.
19+
- **Efficient Input Handling**: OpenScan optimizes input parsing to reduce overhead and improve performance.
20+
- **User-Friendly API**: The API is straightforward, making it easy for developers to integrate into their projects.
21+
- **Open Source**: Fully open-source, allowing for community contributions and enhancements.
22+
- **Console Compatibility**: Works seamlessly in console applications, making it versatile for various use cases.
23+
- **Object-Oriented Design**: Built with object-oriented principles, ensuring clean and maintainable code.
4224

43-
---
25+
## Installation
4426

45-
## Getting Started :
27+
To get started with OpenScan, follow these simple steps:
4628

47-
1. **Download:** Clone or download the `OpenScan.java` file from this repository.
48-
2. **Include:** Add the `OpenScan.java` file to your Java project.
49-
3. **Create Object:** Create an Object from this Code:
29+
1. **Clone the Repository**:
30+
```bash
31+
git clone https://github.com/Samms15/OpenScan.git
32+
```
5033

51-
```java
52-
OpenScan sc = new OpenScan();
53-
```
54-
---
34+
2. **Navigate to the Directory**:
35+
```bash
36+
cd OpenScan
37+
```
38+
39+
3. **Download the Latest Release**: Visit our [Releases](https://github.com/Samms15/OpenScan/releases) section to download the latest version. If you need to run a specific file, make sure to execute the downloaded file as per your operating system's guidelines.
40+
41+
## Usage
42+
43+
Using OpenScan is straightforward. Here’s a simple example to demonstrate how to utilize it in your Java application:
44+
45+
```java
46+
import com.openscan.OpenScan;
47+
48+
public class Main {
49+
public static void main(String[] args) {
50+
OpenScan scanner = new OpenScan();
51+
System.out.println("Enter your name:");
52+
String name = scanner.nextLine();
53+
System.out.println("Hello, " + name + "!");
54+
}
55+
}
56+
```
57+
58+
### Advanced Features
59+
60+
OpenScan offers several advanced features for more complex applications:
61+
62+
- **Custom Input Parsers**: You can create custom parsers for different data types.
63+
- **Error Handling**: Built-in error handling for invalid inputs.
64+
- **Multi-threading Support**: Allows for concurrent input processing.
65+
66+
## Contributing
5567

56-
## Usings :
57-
58-
Assuming that sc is your OpenScan object,
59-
60-
- sc.next() reads the next token from the input.
61-
- sc.nextInt() reads the next token as an integer.
62-
- sc.nextDouble() reads the next token as a double.
63-
- sc.nextLine() reads the next line of text.
64-
- sc.nextChar() reads the first character of the next token.
65-
- sc.nextBoolean() reads the next token as a boolean.
66-
- sc.nextShort() reads the next token as a short.
67-
- sc.nextByte() reads the next token as a byte.
68-
- sc.nextLong() reads the next token as a long.
69-
- sc.nextFloat() reads the next token as a float.
70-
- sc.nextStringList() reads all remaining tokens from the current line as Strings.
71-
- sc.nextIntArray(int count) reads multiple integers from the current line.
72-
- sc.nextLongArray(int count) reads multiple longs from the current line.
73-
- sc.nextDoubleArray(int count) reads multiple doubles from the current line.
74-
- sc.readAllInts() reads all integers from the input until the end of input.
75-
- sc.readAllDoubles() reads all doubles from the input until the end of input.
76-
- sc.readAllLongs() reads all longs from the input until the end of input.
77-
- sc.readAllStrings() reads all strings from the input until the end of input.
78-
- sc.skipLines(int linesToSkip) skips a specified number of lines from the input.
79-
- sc.hasNext() checks if there is another token available.
80-
- sc.close() closes the underlying BufferedReader.
68+
We welcome contributions from the community! If you want to help improve OpenScan, follow these steps:
69+
70+
1. **Fork the Repository**: Click on the "Fork" button at the top right of the page.
71+
2. **Create a New Branch**:
72+
```bash
73+
git checkout -b feature/YourFeature
74+
```
75+
3. **Make Your Changes**: Implement your feature or fix.
76+
4. **Commit Your Changes**:
77+
```bash
78+
git commit -m "Add your message here"
79+
```
80+
5. **Push to Your Branch**:
81+
```bash
82+
git push origin feature/YourFeature
83+
```
84+
6. **Create a Pull Request**: Go to the original repository and click on "New Pull Request."
85+
86+
Your contributions help make OpenScan better for everyone!
87+
88+
## License
89+
90+
OpenScan is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
91+
92+
## Contact
93+
94+
For any inquiries or suggestions, feel free to reach out:
95+
96+
- **Email**: samms15@example.com
97+
- **GitHub**: [Samms15](https://github.com/Samms15)
98+
99+
## Releases
100+
101+
To stay updated with the latest features and improvements, visit our [Releases](https://github.com/Samms15/OpenScan/releases) section. Make sure to download and execute the latest files for the best experience.
102+
103+
## Acknowledgments
104+
105+
We would like to thank all contributors and the open-source community for their support. Your efforts help us build better tools for everyone.
81106

82107
---
108+
109+
Feel free to customize this README as per your needs. Happy coding! 🎉

0 commit comments

Comments
 (0)