diff --git a/src/UglyToad.Pdf/Content/PageFactory.cs b/src/UglyToad.Pdf/Content/PageFactory.cs
index fee4739a..9da824d4 100644
--- a/src/UglyToad.Pdf/Content/PageFactory.cs
+++ b/src/UglyToad.Pdf/Content/PageFactory.cs
@@ -77,7 +77,7 @@
var contentObject = dictionary.GetItemOrDefault(CosName.CONTENTS) as CosObject;
if (contentObject != null)
{
- var contentStream = pdfObjectParser.Parse(contentObject.ToIndirectReference(), reader, false) as RawCosStream;
+ var contentStream = pdfObjectParser.Parse(contentObject.ToIndirectReference(), reader, false) as PdfRawStream;
if (contentStream == null)
{
diff --git a/src/UglyToad.Pdf/Cos/RawCosStream.cs b/src/UglyToad.Pdf/ContentStream/PdfRawStream.cs
similarity index 86%
rename from src/UglyToad.Pdf/Cos/RawCosStream.cs
rename to src/UglyToad.Pdf/ContentStream/PdfRawStream.cs
index 9a703243..b08c9c67 100644
--- a/src/UglyToad.Pdf/Cos/RawCosStream.cs
+++ b/src/UglyToad.Pdf/ContentStream/PdfRawStream.cs
@@ -1,14 +1,14 @@
-namespace UglyToad.Pdf.Cos
+namespace UglyToad.Pdf.ContentStream
{
using System;
- using ContentStream;
+ using Cos;
using Filters;
- internal class RawCosStream : CosBase
+ internal class PdfRawStream : CosBase
{
private static readonly object Lock = new object();
- public readonly byte[] streamBytes;
+ private readonly byte[] streamBytes;
private byte[] decodedBytes;
@@ -17,7 +17,7 @@
///
/// Combines the dictionary for the stream with the raw, encoded/filtered bytes.
///
- public RawCosStream(byte[] streamBytes, PdfDictionary streamDictionary)
+ public PdfRawStream(byte[] streamBytes, PdfDictionary streamDictionary)
{
this.streamBytes = streamBytes;
diff --git a/src/UglyToad.Pdf/Fonts/Parser/Handlers/Type0FontHandler.cs b/src/UglyToad.Pdf/Fonts/Parser/Handlers/Type0FontHandler.cs
index 13bb0cb1..0dd61444 100644
--- a/src/UglyToad.Pdf/Fonts/Parser/Handlers/Type0FontHandler.cs
+++ b/src/UglyToad.Pdf/Fonts/Parser/Handlers/Type0FontHandler.cs
@@ -58,7 +58,7 @@
{
var toUnicodeValue = dictionary[CosName.TO_UNICODE];
- var toUnicode = pdfObjectParser.Parse(((CosObject)toUnicodeValue).ToIndirectReference(), reader, isLenientParsing) as RawCosStream;
+ var toUnicode = pdfObjectParser.Parse(((CosObject)toUnicodeValue).ToIndirectReference(), reader, isLenientParsing) as PdfRawStream;
var decodedUnicodeCMap = toUnicode?.Decode(filterProvider);
@@ -123,7 +123,7 @@
isCMapPredefined = true;
}
- else if (value is RawCosStream stream)
+ else if (value is PdfRawStream stream)
{
var decoded = stream.Decode(filterProvider);
diff --git a/src/UglyToad.Pdf/Fonts/Parser/Parts/CidFontFactory.cs b/src/UglyToad.Pdf/Fonts/Parser/Parts/CidFontFactory.cs
index fefc1bf1..9c28af20 100644
--- a/src/UglyToad.Pdf/Fonts/Parser/Parts/CidFontFactory.cs
+++ b/src/UglyToad.Pdf/Fonts/Parser/Parts/CidFontFactory.cs
@@ -90,7 +90,7 @@
return;
}
- var fontFileStream = pdfObjectParser.Parse(descriptor.FontFile.ObjectKey, reader, isLenientParsing) as RawCosStream;
+ var fontFileStream = pdfObjectParser.Parse(descriptor.FontFile.ObjectKey, reader, isLenientParsing) as PdfRawStream;
if (fontFileStream == null)
{
diff --git a/src/UglyToad.Pdf/Parser/DynamicParser.cs b/src/UglyToad.Pdf/Parser/DynamicParser.cs
index 369436b1..316e131e 100644
--- a/src/UglyToad.Pdf/Parser/DynamicParser.cs
+++ b/src/UglyToad.Pdf/Parser/DynamicParser.cs
@@ -166,7 +166,7 @@
{
if (currentBase is PdfDictionary dictionary)
{
- RawCosStream stream = streamParser.Parse(reader, dictionary, isLenientParsing);
+ PdfRawStream stream = streamParser.Parse(reader, dictionary, isLenientParsing);
currentBase = stream;
}
@@ -201,7 +201,7 @@
var baseStream = Parse(reader, streamObjectNumber, 0, objectPool, crossReferenceTable, bruteForceSearcher,
isLenientParsing, true);
- if (!(baseStream is RawCosStream stream))
+ if (!(baseStream is PdfRawStream stream))
{
log.Warn($"Could not find a stream for the object number, defaults to returning CosNull: {streamObjectNumber}");
diff --git a/src/UglyToad.Pdf/Parser/IPdfObjectParser.cs b/src/UglyToad.Pdf/Parser/IPdfObjectParser.cs
index 3445dad7..996f08bf 100644
--- a/src/UglyToad.Pdf/Parser/IPdfObjectParser.cs
+++ b/src/UglyToad.Pdf/Parser/IPdfObjectParser.cs
@@ -142,7 +142,7 @@
{
if (currentBase is PdfDictionary dictionary)
{
- RawCosStream stream = streamParser.Parse(reader, dictionary, isLenientParsing);
+ PdfRawStream stream = streamParser.Parse(reader, dictionary, isLenientParsing);
currentBase = stream;
}
@@ -176,7 +176,7 @@
{
var baseStream = Parse(new IndirectReference(streamObjectNumber, 0), reader, isLenientParsing, true);
- if (!(baseStream is RawCosStream stream))
+ if (!(baseStream is PdfRawStream stream))
{
log.Warn($"Could not find a stream for the object number, defaults to returning CosNull: {streamObjectNumber}");
diff --git a/src/UglyToad.Pdf/Parser/ObjectStreamParser.cs b/src/UglyToad.Pdf/Parser/ObjectStreamParser.cs
index a81b5955..4a9df069 100644
--- a/src/UglyToad.Pdf/Parser/ObjectStreamParser.cs
+++ b/src/UglyToad.Pdf/Parser/ObjectStreamParser.cs
@@ -2,6 +2,7 @@
{
using System;
using System.Collections.Generic;
+ using ContentStream;
using ContentStream.TypedAccessors;
using Cos;
using Filters;
@@ -22,7 +23,7 @@
this.baseParser = baseParser;
}
- public IReadOnlyList Parse(RawCosStream stream, CosObjectPool pool)
+ public IReadOnlyList Parse(PdfRawStream stream, CosObjectPool pool)
{
if (stream == null)
{
diff --git a/src/UglyToad.Pdf/Parser/Parts/CosStreamParser.cs b/src/UglyToad.Pdf/Parser/Parts/CosStreamParser.cs
index 26c93559..90415fd4 100644
--- a/src/UglyToad.Pdf/Parser/Parts/CosStreamParser.cs
+++ b/src/UglyToad.Pdf/Parser/Parts/CosStreamParser.cs
@@ -32,9 +32,9 @@
this.log = log;
}
- public RawCosStream Parse(IRandomAccessRead reader, PdfDictionary streamDictionary, bool isLenientParsing)
+ public PdfRawStream Parse(IRandomAccessRead reader, PdfDictionary streamDictionary, bool isLenientParsing)
{
- RawCosStream result;
+ PdfRawStream result;
// read 'stream'; this was already tested in parseObjectsDynamically()
ReadHelper.ReadExpectedString(reader, "stream");
@@ -59,7 +59,7 @@
ReadUntilEndStream(reader, writer);
}
- result = new RawCosStream(stream.ToArray(), streamDictionary);
+ result = new PdfRawStream(stream.ToArray(), streamDictionary);
}
String endStream = ReadHelper.ReadString(reader);
diff --git a/src/UglyToad.Pdf/Parser/Parts/CrossReference/CrossReferenceStreamParser.cs b/src/UglyToad.Pdf/Parser/Parts/CrossReference/CrossReferenceStreamParser.cs
index e2276dd8..4b3e3138 100644
--- a/src/UglyToad.Pdf/Parser/Parts/CrossReference/CrossReferenceStreamParser.cs
+++ b/src/UglyToad.Pdf/Parser/Parts/CrossReference/CrossReferenceStreamParser.cs
@@ -2,6 +2,7 @@
{
using System.Collections.Generic;
using System.IO;
+ using ContentStream;
using ContentStream.TypedAccessors;
using Cos;
using Filters;
@@ -18,15 +19,15 @@
///
/// Parses through the unfiltered stream and populates the xrefTable HashMap.
///
- public CrossReferenceTablePart Parse(long streamOffset, RawCosStream cosStream)
+ public CrossReferenceTablePart Parse(long streamOffset, PdfRawStream stream)
{
- var w = cosStream.Dictionary.GetDictionaryObject(CosName.W);
+ var w = stream.Dictionary.GetDictionaryObject(CosName.W);
if (!(w is COSArray format))
{
throw new IOException("/W array is missing in Xref stream");
}
- var objNums = GetObjectNumbers(cosStream);
+ var objNums = GetObjectNumbers(stream);
/*
* Calculating the size of the line in bytes
@@ -36,7 +37,7 @@
int w2 = format.getInt(2);
int lineSize = w0 + w1 + w2;
- var decoded = cosStream.Decode(filterProvider);
+ var decoded = stream.Decode(filterProvider);
var lineCount = decoded.Length / lineSize;
var lineNumber = 0;
@@ -44,8 +45,8 @@
var builder = new CrossReferenceTablePartBuilder
{
Offset = streamOffset,
- Previous = cosStream.Dictionary.GetLongOrDefault(CosName.PREV),
- Dictionary = cosStream.Dictionary,
+ Previous = stream.Dictionary.GetLongOrDefault(CosName.PREV),
+ Dictionary = stream.Dictionary,
XRefType = CrossReferenceType.Stream
};
@@ -141,16 +142,16 @@
return builder.AsCrossReferenceTablePart();
}
- private static List GetObjectNumbers(RawCosStream cosStream)
+ private static List GetObjectNumbers(PdfRawStream stream)
{
- var indexArray = (COSArray) cosStream.Dictionary.GetDictionaryObject(CosName.INDEX);
+ var indexArray = (COSArray) stream.Dictionary.GetDictionaryObject(CosName.INDEX);
// If Index doesn't exist, we will use the default values.
if (indexArray == null)
{
indexArray = new COSArray();
indexArray.add(CosInt.Zero);
- indexArray.add(cosStream.Dictionary.GetDictionaryObject(CosName.SIZE));
+ indexArray.add(stream.Dictionary.GetDictionaryObject(CosName.SIZE));
}
List objNums = new List();
diff --git a/src/UglyToad.Pdf/Parser/Parts/CrossReference/FileCrossReferenceTableParser.cs b/src/UglyToad.Pdf/Parser/Parts/CrossReference/FileCrossReferenceTableParser.cs
index c79b3cfa..d272ba20 100644
--- a/src/UglyToad.Pdf/Parser/Parts/CrossReference/FileCrossReferenceTableParser.cs
+++ b/src/UglyToad.Pdf/Parser/Parts/CrossReference/FileCrossReferenceTableParser.cs
@@ -176,7 +176,7 @@
PdfDictionary dict = dictionaryParser.Parse(reader, baseParser, pool);
- RawCosStream xrefStream = streamParser.Parse(reader, dict, isLenientParsing);
+ PdfRawStream xrefStream = streamParser.Parse(reader, dict, isLenientParsing);
CrossReferenceTablePart xrefTablePart = crossReferenceStreamParser.Parse(objByteOffset, xrefStream);
return xrefTablePart;