From 0511fbfce58bb61eada5e1885d05983b22002d73 Mon Sep 17 00:00:00 2001 From: Robert Greene Date: Sun, 22 Jun 2008 23:57:49 +0000 Subject: [PATCH] Switched ByteSource to be an InputStream; renamed ByteSource LittleEndianByteInputStream. --- src/com/webcodepro/shrinkit/HeaderBlock.java | 6 ++-- .../shrinkit/MasterHeaderBlock.java | 6 ++-- .../webcodepro/shrinkit/NuFileArchive.java | 4 ++- src/com/webcodepro/shrinkit/ThreadRecord.java | 6 ++-- .../shrinkit/{ => io}/ByteConstants.java | 7 ++-- .../LittleEndianByteInputStream.java} | 18 +++++----- .../shrinkit/io/RleInputStream.java | 7 ++-- .../webcodepro/shrinkit/HeaderBlockTest.java | 34 +++++++++--------- .../shrinkit/MasterHeaderBlockTest.java | 10 +++--- .../webcodepro/shrinkit/ThreadRecordTest.java | 12 ++++--- .../LittleEndianByteInputStreamTest.java} | 36 +++++++++---------- .../com/webcodepro/shrinkit/io/LzwTest.java | 3 +- .../com/webcodepro/shrinkit/io/RleTest.java | 3 +- 13 files changed, 83 insertions(+), 69 deletions(-) rename src/com/webcodepro/shrinkit/{ => io}/ByteConstants.java (89%) rename src/com/webcodepro/shrinkit/{ByteSource.java => io/LittleEndianByteInputStream.java} (85%) rename test_src/com/webcodepro/shrinkit/{ByteSourceTest.java => io/LittleEndianByteInputStreamTest.java} (65%) diff --git a/src/com/webcodepro/shrinkit/HeaderBlock.java b/src/com/webcodepro/shrinkit/HeaderBlock.java index 940c136..26ca778 100644 --- a/src/com/webcodepro/shrinkit/HeaderBlock.java +++ b/src/com/webcodepro/shrinkit/HeaderBlock.java @@ -5,6 +5,8 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; +import com.webcodepro.shrinkit.io.LittleEndianByteInputStream; + /** * The Header Block contains information and content * about a single entry (be it a file or disk image). @@ -40,7 +42,7 @@ public class HeaderBlock { * Create the Header Block. This is done dynamically since * the Header Block size varies significantly. */ - public HeaderBlock(ByteSource bs) throws IOException { + public HeaderBlock(LittleEndianByteInputStream bs) throws IOException { bs.checkNuFxId(); headerCrc = bs.readWord(); attribCount = bs.readWord(); @@ -81,7 +83,7 @@ public class HeaderBlock { * Read in all data threads. All ThreadRecords are read and then * each thread's data is read (per NuFX spec). */ - public void readThreads(ByteSource bs) throws IOException { + public void readThreads(LittleEndianByteInputStream bs) throws IOException { threads = new ArrayList(); for (long l=0; l(); for (int i=0; i