clean up libjava includes

This commit is contained in:
Tropical 2026-03-31 02:00:20 -05:00
parent bed181cd59
commit ea539a7e58
32 changed files with 100 additions and 30 deletions

View file

@ -1,4 +1,6 @@
#pragma once
#include <vector>
#include "Buffer.h"
#include "../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO

View file

@ -1,7 +1,11 @@
#pragma once
#include <stdint.h>
#include <vector>
#include <cstdint>
#include <vector>
#include "OutputStream.h"
#include "../../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO
class BufferedOutputStream : public OutputStream {
private:

View file

@ -2,6 +2,8 @@
#include "Reader.h"
#include <string>
class BufferedReader : public Reader {
private:
Reader* reader;

View file

@ -1,8 +1,10 @@
#pragma once
// 4J Stu - Represents Java standard library class
#include <vector>
#include <cstdint>
#include "InputStream.h"
#include "../../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO
class ByteArrayInputStream : public InputStream {
protected:

View file

@ -1,7 +1,9 @@
#pragma once
#include "OutputStream.h"
#include "../../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO
#include <vector>
#include <cstdint>
class ByteArrayOutputStream : public OutputStream {
// Note - when actually implementing, std::vector<uint8_t> will need to grow as data is

View file

@ -1,6 +1,8 @@
#pragma once
#include "../../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO
#include <vector>
#include <string>
#include <cstdint>
class DataInput {
public:

View file

@ -3,12 +3,11 @@
// intermediate inheritance class that we don't care about)
#include <string>
#include <cstdint>
#include "InputStream.h"
#include "DataInput.h"
#include "../../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO
class DataInputStream : public InputStream, public DataInput {
private:
InputStream* stream;

View file

@ -1,6 +1,8 @@
#pragma once
#include "../../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO
#include <vector>
#include <string>
#include <cstdint>
class DataOutput {
public:

View file

@ -4,9 +4,6 @@
#include <string>
#include "../../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO
#include "OutputStream.h"
#include "DataOutput.h"

View file

@ -4,8 +4,6 @@
#include <cstdio>
#include <cstdint>
#include "../../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO
#include "InputStream.h"
class File;

View file

@ -3,8 +3,6 @@
#include <cstdio>
#include "../../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO
#include "OutputStream.h"
class File;

View file

@ -4,8 +4,6 @@
#include <cstdint>
#include "../../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO
#include "InputStream.h"
class GZIPInputStream : public InputStream {

View file

@ -2,8 +2,6 @@
// 4J Stu - We are not using GZIP compression, so this is just a pass through
// class
#include "../../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO
#include "OutputStream.h"
class GZIPOutputStream : public OutputStream {

View file

@ -1,10 +1,9 @@
#pragma once
#include <vector>
#include <cstdint>
#include <string>
#include "../../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO
// 4J Stu - Represents Java standard lib abstract
class InputStream {

View file

@ -1,7 +1,5 @@
#pragma once
#include "../../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO
// 4J Stu - Represents Java standard lib abstract
class OutputStream {

View file

@ -1,7 +1,8 @@
#pragma once
#include "../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO
#include <vector>
#include "../../../Minecraft.World/ConsoleHelpers/ArrayWithLength.h" // 4jcraft TODO
#include "Buffer.h"
class IntBuffer : public Buffer {

View file

@ -1,4 +1,5 @@
#include "java/Buffer.h"
#include <cassert>
Buffer::Buffer(unsigned int capacity)
: m_capacity(capacity),

View file

@ -1,7 +1,15 @@
#include <assert.h>
#include <stdint.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include "java/IntBuffer.h"
#include "java/FloatBuffer.h"
#include "java/ByteBuffer.h"
#include "/home/tropical/Documents/GitHub/4jcraft/minecraft/Minecraft.World/ConsoleHelpers/Definitions.h"
#include "java/Buffer.h"
ByteBuffer::ByteBuffer(unsigned int capacity) : Buffer(capacity) {
hasBackingArray = false;

View file

@ -1,9 +1,14 @@
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <chrono>
#include <filesystem>
#include <string>
#include <system_error>
#include <vector>
#include "java/FileFilter.h"
#include "java/File.h"
#include "../../Minecraft.World/ConsoleHelpers/PathHelper.h" // 4jcraft TODO
#include "../../Minecraft.World/ConsoleHelpers/StringHelpers.h" // 4jcraft TODO

View file

@ -1,5 +1,10 @@
#include "java/FloatBuffer.h"
#include <assert.h>
#include <string.h>
#include "java/Buffer.h"
// Allocates a new float buffer.
// The new buffer's position will be zero, its limit will be its capacity, and
// its mark will be undefined. It will have a backing array, and its array

View file

@ -1,5 +1,9 @@
#include "java/InputOutputStream/BufferedOutputStream.h"
#include <stdio.h>
#include "java/InputOutputStream/OutputStream.h"
// Creates a new buffered output stream to write data to the specified
// underlying output stream with the specified buffer size. Parameters: out -
// the underlying output stream. size - the buffer size.

View file

@ -1,5 +1,8 @@
#include "java/InputOutputStream/BufferedReader.h"
#include <cstring>
#include <cassert>
// Creates a buffering character-input stream that uses a default-sized input
// buffer. Parameters: in - A Reader
BufferedReader::BufferedReader(Reader* in)

View file

@ -1,4 +1,3 @@
#include "java/InputOutputStream/InputOutputStream.h"
// Creates ByteArrayInputStream that uses buf as its buffer array. The initial
// value of pos is offset and the initial value of count is the minimum of
@ -6,6 +5,13 @@
// mark is set to the specified offset. Parameters: buf - the input buffer.
// offset - the offset in the buffer of the first byte to read.
// length - the maximum number of bytes to read from the buffer.
#include <stdint.h>
#include <algorithm>
#include <cstring>
#include <vector>
#include "java/InputOutputStream/ByteArrayInputStream.h"
ByteArrayInputStream::ByteArrayInputStream(std::vector<uint8_t>& buf, unsigned int offset,
unsigned int length)
: pos(offset), count(std::min(offset + length, (unsigned int)buf.size())), mark(offset) {

View file

@ -1,5 +1,9 @@
#include "java/InputOutputStream/ByteArrayOutputStream.h"
#include <assert.h>
#include <algorithm>
#include <cstring>
// Creates a new byte array output stream. The buffer capacity is initially 32
// bytes, though its size increases if necessary.
ByteArrayOutputStream::ByteArrayOutputStream() {

View file

@ -1,7 +1,11 @@
#include <stdio.h>
#include <bit>
#include <cstdint>
#include <string>
#include <vector>
#include "java/InputOutputStream/DataInputStream.h"
#include "java/InputOutputStream/InputStream.h"
// Creates a DataInputStream that uses the specified underlying InputStream.
// Parameters:

View file

@ -1,7 +1,11 @@
#include <stdio.h>
#include <bit>
#include <cstdint>
#include <string>
#include <vector>
#include "java/InputOutputStream/DataOutputStream.h"
#include "java/InputOutputStream/OutputStream.h"
// Creates a new data output stream to write data to the specified underlying
// output stream. The counter written is set to zero. Parameters: out - the

View file

@ -1,8 +1,14 @@
#include <assert.h>
#include <sys/types.h>
#include <algorithm>
#include <cstdint>
#include <cstdio>
#include <string>
#include <vector>
#include "java/File.h"
#include "java/InputOutputStream/FileInputStream.h"
#include <algorithm>
#include "../../../Minecraft.World/ConsoleHelpers/StringHelpers.h"
namespace {

View file

@ -1,6 +1,8 @@
#include <string>
#include "java/File.h"
#include "java/InputOutputStream/InputOutputStream.h"
#include "java/InputOutputStream/InputStream.h"
#include "java/InputOutputStream/FileInputStream.h"
InputStream* InputStream::getResourceAsStream(const std::wstring& fileName) {
File file(fileName);

View file

@ -1,7 +1,8 @@
#include "java/InputOutputStream/InputStream.h"
#include "java/InputOutputStream/DataInputStream.h"
#include "java/InputOutputStream/InputStreamReader.h"
class InputStream;
// Creates an InputStreamReader that uses the default charset.
// Parameters:
// in - An InputStream

View file

@ -1,5 +1,11 @@
#include "java/IntBuffer.h"
#include <assert.h>
#include <string.h>
#include <algorithm>
#include "java/Buffer.h"
// Allocates a new int buffer.
// The new buffer's position will be zero, its limit will be its capacity, and
// its mark will be undefined. It will have a backing array, and its array

View file

@ -1,11 +1,19 @@
#if defined(__linux__)
#include <sys/time.h>
#include <time.h>
#include <ctime>
#endif
#include <assert.h>
#include <stdint.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include "java/System.h"
class Biome;
class Node;
template <class T>
void System::arraycopy(const std::vector<T>& src, unsigned int srcPos,
std::vector<T>* dst, unsigned int dstPos,

View file

@ -3,6 +3,7 @@
#include <memory>
#include <vector>
#include <cstring>
template <class T>
class ListTag : public Tag {