-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package arclibrary.io; | ||
|
||
import arc.util.io.*; | ||
|
||
import java.io.*; | ||
/** | ||
* Uses to read something from clear bytes | ||
* */ | ||
public class ByteReads extends Reads{ | ||
public final ReusableByteInStream r = new ReusableByteInStream(); | ||
|
||
public ByteReads(){ | ||
super(null); | ||
input = new DataInputStream(r); | ||
} | ||
|
||
public ByteReads(byte[] bytes){ | ||
this(); | ||
setBytes(bytes); | ||
} | ||
|
||
public static ReusableByteInStream setBytes(Reads reads, byte[] bytes){ | ||
if(reads instanceof ByteReads){ | ||
ByteReads byteReads = (ByteReads)reads; | ||
byteReads.setBytes(bytes); | ||
return byteReads.r; | ||
} | ||
ReusableByteInStream reusableByteInStream = new ReusableByteInStream(); | ||
reads.input = new DataInputStream(reusableByteInStream); | ||
reusableByteInStream.setBytes(bytes); | ||
return reusableByteInStream; | ||
} | ||
|
||
public void setBytes(byte[] bytes){ | ||
r.setBytes(bytes); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package arclibrary.io; | ||
|
||
import arc.util.io.*; | ||
|
||
import java.io.*; | ||
|
||
/** | ||
* Uses to write something to clear bytes | ||
* */ | ||
public class ByteWrites extends Writes{ | ||
public final ReusableByteOutStream r = new ReusableByteOutStream(8192); | ||
|
||
public ByteWrites(){ | ||
super(null); | ||
output = new DataOutputStream(r); | ||
} | ||
public void reset(){ | ||
r.reset(); | ||
} | ||
|
||
public byte[] getBytes(){ | ||
return r.toByteArray(); | ||
} | ||
} |