make everything internal which does not need to be public

This commit is contained in:
Eliot Jones
2017-12-31 14:23:36 +00:00
parent a77e8e1a56
commit d668c4e892
30 changed files with 85 additions and 541 deletions

View File

@@ -4,7 +4,7 @@
using ContentStream; using ContentStream;
using Cos; using Cos;
public class Catalog internal class Catalog
{ {
private readonly PdfDictionary catalogDictionary; private readonly PdfDictionary catalogDictionary;

View File

@@ -10,7 +10,7 @@
using Logging; using Logging;
using Parser; using Parser;
public class Pages internal class Pages
{ {
private readonly ILog log; private readonly ILog log;
private readonly Catalog catalog; private readonly Catalog catalog;

View File

@@ -7,7 +7,7 @@
using Cos; using Cos;
using Util.JetBrains.Annotations; using Util.JetBrains.Annotations;
public class PdfDictionary : CosBase, IReadOnlyDictionary<CosName, CosBase> internal class PdfDictionary : CosBase, IReadOnlyDictionary<CosName, CosBase>
{ {
private readonly Dictionary<CosName, CosBase> inner = new Dictionary<CosName, CosBase>(); private readonly Dictionary<CosName, CosBase> inner = new Dictionary<CosName, CosBase>();

View File

@@ -2,10 +2,9 @@
{ {
using System.Collections.Generic; using System.Collections.Generic;
using Cos; using Cos;
using Util;
using Util.JetBrains.Annotations; using Util.JetBrains.Annotations;
public static class DictionaryValueAccessorExtensions internal static class DictionaryValueAccessorExtensions
{ {
public static long GetLongOrDefault(this PdfDictionary dictionary, CosName key) public static long GetLongOrDefault(this PdfDictionary dictionary, CosName key)
{ {

View File

@@ -2,7 +2,7 @@
{ {
using Cos; using Cos;
public static class DictionaryValueSetterExtensions internal static class DictionaryValueSetterExtensions
{ {
public static void SetLong(this PdfDictionary dictionary, CosName key, long value) public static void SetLong(this PdfDictionary dictionary, CosName key, long value)
{ {

View File

@@ -1,440 +0,0 @@
namespace UglyToad.Pdf.Cos
{
using System;
using System.Collections.Generic;
using System.Linq;
using IO;
using Parser;
using Parser.Parts;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This is the in-memory representation of the PDF document. You need to call
* close() on this object when you are done using it!!
*
* @author Ben Litchfield
*
*/
public class COSDocument : CosBase, IDisposable
{
private float version = 1.4f;
/**
* Maps ObjectKeys to a COSObject. Note that references to these objects
* are also stored in COSDictionary objects that map a name to a specific object.
*/
private readonly Dictionary<CosObjectKey, CosObject> objectPool = new Dictionary<CosObjectKey, CosObject>();
/**
* Maps object and generation id to object byte offsets.
*/
private readonly Dictionary<CosObjectKey, long> xrefTable = new Dictionary<CosObjectKey, long>();
/**
* Document trailer dictionary.
*/
public CosDictionary trailer;
private bool warnMissingClose = true;
/**
* Signal that document is already decrypted.
*/
private bool closed = false;
/**
* This will get the first dictionary object by type.
*
* @param type The type of the object.
*
* @return This will return an object with the specified type.
* @throws IOException If there is an error getting the object
*/
public CosObject getObjectByType(CosName type)
{
foreach (CosObject obj in objectPool.Values)
{
var realObject = obj.GetObject();
if (realObject is CosDictionary dic)
{
try
{
var typeItem = dic.getItem(CosName.TYPE);
if (typeItem is CosName objectType)
{
if (objectType.Equals(type))
{
return obj;
}
}
else if (typeItem != null)
{
//LOG.debug("Expected a /Name object after /Type, got '" + typeItem + "' instead");
}
}
catch (InvalidCastException e)
{
//LOG.warn(e, e);
}
}
}
return null;
}
/**
* This will get all dictionary objects by type.
*
* @param type The type of the object.
*
* @return This will return an object with the specified type.
* @throws IOException If there is an error getting the object
*/
public List<CosObject> getObjectsByType(String type)
{
return getObjectsByType(CosName.Create(type));
}
/**
* This will get a dictionary object by type.
*
* @param type The type of the object.
*
* @return This will return an object with the specified type.
* @throws IOException If there is an error getting the object
*/
public List<CosObject> getObjectsByType(CosName type)
{
var retval = new List<CosObject>();
foreach (var obj in objectPool.Values)
{
var realObject = obj.GetObject();
if (realObject is CosDictionary dic)
{
try
{
var typeItem = dic.getItem(CosName.TYPE);
if (typeItem is CosName objectType)
{
if (objectType.Equals(type))
{
retval.Add(obj);
}
}
else if (typeItem != null)
{
//LOG.debug("Expected a /Name object after /Type, got '" + typeItem + "' instead");
}
}
catch (InvalidCastException e)
{
//LOG.warn(e, e);
}
}
}
return retval;
}
/**
* Returns the CosObjectKey for a given COS object, or null if there is none.
* This lookup iterates over all objects in a PDF, which may be slow for large files.
*
* @param object COS object
* @return key
*/
public CosObjectKey getKey(CosBase obj)
{
foreach (var entry in objectPool)
{
if (entry.Value.GetObject() == obj)
{
return entry.Key;
}
}
return null;
}
/**
* This will print contents to stdout.
*/
public void print()
{
foreach (CosObject obj in objectPool.Values)
{
Console.WriteLine(obj);
}
}
public decimal Version { get; set; }
public bool IsDecrypted { get; set; }
/**
* This will tell if this is an encrypted document.
*
* @return true If this document is encrypted.
*/
public bool isEncrypted()
{
var encrypted = false;
if (trailer != null)
{
encrypted = trailer.getDictionaryObject(CosName.ENCRYPT) != null;
}
return encrypted;
}
/**
* This will get the encryption dictionary if the document is encrypted or null
* if the document is not encrypted.
*
* @return The encryption dictionary.
*/
public CosDictionary getEncryptionDictionary()
{
return (CosDictionary)trailer.getDictionaryObject(CosName.ENCRYPT);
}
/**
* This will set the encryption dictionary, this should only be called when
* encrypting the document.
*
* @param encDictionary The encryption dictionary.
*/
public void setEncryptionDictionary(CosDictionary encDictionary)
{
trailer.setItem(CosName.ENCRYPT, encDictionary);
}
/**
* This will get the document ID.
*
* @return The document id.
*/
public COSArray getDocumentID()
{
return (COSArray)getTrailer().getDictionaryObject(CosName.ID);
}
/**
* This will set the document ID.
*
* @param id The document id.
*/
public void setDocumentID(COSArray id)
{
getTrailer().setItem(CosName.ID, id);
}
/**
* This will get the document catalog.
*
* @return @return The catalog is the root of the document; never null.
*
* @throws IOException If no catalog can be found.
*/
public CosObject getCatalog()
{
CosObject catalog = getObjectByType(CosName.CATALOG);
if (catalog == null)
{
throw new InvalidOperationException("Catalog cannot be found");
}
return catalog;
}
/**
* This will get a list of all available objects.
*
* @return A list of all objects, never null.
*/
public List<CosObject> getObjects()
{
return objectPool.Values.ToList();
}
/**
* This will get the document trailer.
*
* @return the document trailer dict
*/
public CosDictionary getTrailer()
{
return trailer;
}
/**
* // MIT added, maybe this should not be supported as trailer is a persistence construct.
* This will set the document trailer.
*
* @param newTrailer the document trailer dictionary
*/
public void setTrailer(CosDictionary newTrailer)
{
trailer = newTrailer;
}
/**
* visitor pattern double dispatch method.
*
* @param visitor The object to notify when visiting this object.
* @return any object, depending on the visitor implementation, or null
* @throws IOException If an error occurs while visiting this object.
*/
public override object Accept(ICosVisitor visitor)
{
return visitor.VisitFromDocument(this);
}
/**
* This will close all storage and delete the tmp files.
*
* @throws IOException If there is an error close resources.
*/
public void Dispose()
{
if (!closed)
{
// close all open I/O streams
foreach (CosObject obj in getObjects())
{
CosBase cosObject = obj.GetObject();
}
closed = true;
}
}
/**
* Returns true if this document has been closed.
*/
public bool isClosed()
{
return closed;
}
/**
* Warn the user in the finalizer if he didn't close the PDF document. The method also
* closes the document just in case, to avoid abandoned temporary files. It's still a good
* idea for the user to close the PDF document at the earliest possible to conserve resources.
* @throws IOException if an error occurs while closing the temporary files
*/
~COSDocument()
{
if (!closed)
{
if (warnMissingClose)
{
//LOG.warn("Warning: You did not close a PDF Document");
}
Dispose();
}
}
/**
* Controls whether this instance shall issue a warning if the PDF document wasn't closed
* properly through a call to the {@link #close()} method. If the PDF document is held in
* a cache governed by soft references it is impossible to reliably close the document
* before the warning is raised. By default, the warning is enabled.
* @param warn true enables the warning, false disables it.
*/
public void setWarnMissingClose(bool warn)
{
this.warnMissingClose = warn;
}
/**
* This will get an object from the pool.
*
* @param key The object key.
*
* @return The object in the pool or a new one if it has not been parsed yet.
*
* @throws IOException If there is an error getting the proxy object.
*/
public CosObject getObjectFromPool(CosObjectKey key)
{
if (key != null)
{
if (objectPool.TryGetValue(key, out var value))
{
return value;
}
}
// this was a forward reference, make "proxy" object
var obj = new CosObject(null);
if (key != null)
{
obj.SetObjectNumber(key.Number);
obj.SetGenerationNumber((int)key.Generation);
objectPool[key] = obj;
}
return obj;
}
/**
* Removes an object from the object pool.
* @param key the object key
* @return the object that was removed or null if the object was not found
*/
public CosObject removeObject(CosObjectKey key)
{
if (!objectPool.TryGetValue(key, out CosObject result))
{
return null;
}
objectPool.Remove(key);
return result;
}
/**
* Populate XRef HashMap with given values.
* Each entry maps ObjectKeys to byte offsets in the file.
* @param xrefTableValues xref table entries to be added
*/
public void addXRefTable(Dictionary<CosObjectKey, long> xrefTableValues)
{
foreach (var value in xrefTableValues)
{
xrefTable[value.Key] = value.Value;
}
}
/**
* Returns the xrefTable which is a mapping of ObjectKeys
* to byte offsets in the file.
* @return mapping of ObjectsKeys to byte offsets
*/
public Dictionary<CosObjectKey, long> getXrefTable()
{
return xrefTable;
}
public long StartXRef { get; set; }
public bool IsXRefStream { get; set; }
}
}

View File

@@ -25,7 +25,8 @@ namespace UglyToad.Pdf.Cos
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
public class COSArray : CosBase, IEnumerable<CosBase>, ICosUpdateInfo
internal class COSArray : CosBase, IEnumerable<CosBase>, ICosUpdateInfo
{ {
private readonly List<CosBase> objects = new List<CosBase>(); private readonly List<CosBase> objects = new List<CosBase>();
public bool NeedsToBeUpdated { get; set; } public bool NeedsToBeUpdated { get; set; }

View File

@@ -1,10 +1,6 @@
using System; namespace UglyToad.Pdf.Cos
using System.Collections.Generic;
using System.Text;
namespace UglyToad.Pdf.Cos
{ {
public abstract class CosBase : ICosObject internal abstract class CosBase : ICosObject
{ {
public bool Direct { get; set; } public bool Direct { get; set; }
@@ -16,7 +12,7 @@ namespace UglyToad.Pdf.Cos
public abstract object Accept(ICosVisitor visitor); public abstract object Accept(ICosVisitor visitor);
} }
public interface ICosObject internal interface ICosObject
{ {
CosBase GetCosObject(); CosBase GetCosObject();
} }

View File

@@ -3,7 +3,7 @@
using System.IO; using System.IO;
using Core; using Core;
public class CosBoolean : CosBase, ICosStreamWriter internal class CosBoolean : CosBase, ICosStreamWriter
{ {
/** /**
* The true boolean token. * The true boolean token.

View File

@@ -1,13 +1,12 @@
using System; namespace UglyToad.Pdf.Cos
using System.Collections.Generic;
using System.Text;
namespace UglyToad.Pdf.Cos
{ {
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq; using System.Linq;
using Util; using Util;
public class CosDictionary : CosBase, ICosUpdateInfo internal class CosDictionary : CosBase, ICosUpdateInfo
{ {
private static readonly string PATH_SEPARATOR = "/"; private static readonly string PATH_SEPARATOR = "/";
private bool needToBeUpdated; private bool needToBeUpdated;
@@ -63,7 +62,7 @@ namespace UglyToad.Pdf.Cos
var contains = items.Values.Any(x => ReferenceEquals(x, value)); var contains = items.Values.Any(x => ReferenceEquals(x, value));
if (!contains && value is CosObject) if (!contains && value is CosObject)
{ {
contains = items.ContainsValue(((CosObject) value).GetObject()); contains = items.ContainsValue(((CosObject)value).GetObject());
} }
return contains; return contains;
} }
@@ -80,7 +79,7 @@ namespace UglyToad.Pdf.Cos
{ {
Object nextValue = item.Value; Object nextValue = item.Value;
if (nextValue.Equals(value) if (nextValue.Equals(value)
|| nextValue is CosObject && ((CosObject) nextValue).GetObject() || nextValue is CosObject && ((CosObject)nextValue).GetObject()
.Equals(value)) .Equals(value))
{ {
return item.Key; return item.Key;
@@ -176,7 +175,7 @@ namespace UglyToad.Pdf.Cos
if (result is CosObject) if (result is CosObject)
{ {
result = ((CosObject) result).GetObject(); result = ((CosObject)result).GetObject();
} }
if (result is CosNull) if (result is CosNull)
{ {
@@ -239,7 +238,7 @@ namespace UglyToad.Pdf.Cos
*/ */
public void setbool(String key, bool value) public void setbool(String key, bool value)
{ {
setItem(CosName.Create(key), (CosBoolean) value); setItem(CosName.Create(key), (CosBoolean)value);
} }
/** /**
@@ -250,7 +249,7 @@ namespace UglyToad.Pdf.Cos
*/ */
public void setbool(CosName key, bool value) public void setbool(CosName key, bool value)
{ {
setItem(key, (CosBoolean) value); setItem(key, (CosBoolean)value);
} }
/** /**
@@ -336,7 +335,7 @@ namespace UglyToad.Pdf.Cos
*/ */
public void setEmbeddedDate(String embedded, CosName key, DateTime date) public void setEmbeddedDate(String embedded, CosName key, DateTime date)
{ {
CosDictionary dic = (CosDictionary) getDictionaryObject(embedded); CosDictionary dic = (CosDictionary)getDictionaryObject(embedded);
if (dic == null) if (dic == null)
{ {
dic = new CosDictionary(); dic = new CosDictionary();
@@ -397,7 +396,7 @@ namespace UglyToad.Pdf.Cos
*/ */
public void setEmbeddedString(String embedded, CosName key, String value) public void setEmbeddedString(String embedded, CosName key, String value)
{ {
CosDictionary dic = (CosDictionary) getDictionaryObject(embedded); CosDictionary dic = (CosDictionary)getDictionaryObject(embedded);
if (dic == null && value != null) if (dic == null && value != null)
{ {
dic = new CosDictionary(); dic = new CosDictionary();
@@ -475,7 +474,7 @@ namespace UglyToad.Pdf.Cos
*/ */
public void setEmbeddedInt(String embeddedDictionary, CosName key, int value) public void setEmbeddedInt(String embeddedDictionary, CosName key, int value)
{ {
CosDictionary embedded = (CosDictionary) getDictionaryObject(embeddedDictionary); CosDictionary embedded = (CosDictionary)getDictionaryObject(embeddedDictionary);
if (embedded == null) if (embedded == null)
{ {
embedded = new CosDictionary(); embedded = new CosDictionary();
@@ -540,7 +539,7 @@ namespace UglyToad.Pdf.Cos
CosBase name = getDictionaryObject(key); CosBase name = getDictionaryObject(key);
if (name is CosName) if (name is CosName)
{ {
return (CosName) name; return (CosName)name;
} }
return null; return null;
} }
@@ -558,7 +557,7 @@ namespace UglyToad.Pdf.Cos
CosBase name = getDictionaryObject(key); CosBase name = getDictionaryObject(key);
if (name is CosName) if (name is CosName)
{ {
return (CosName) name; return (CosName)name;
} }
return defaultValue; return defaultValue;
} }
@@ -588,11 +587,11 @@ namespace UglyToad.Pdf.Cos
CosBase name = getDictionaryObject(key); CosBase name = getDictionaryObject(key);
if (name is CosName) if (name is CosName)
{ {
retval = ((CosName) name).Name; retval = ((CosName)name).Name;
} }
else if (name is CosString) else if (name is CosString)
{ {
retval = ((CosString) name).GetString(); retval = ((CosString)name).GetString();
} }
return retval; return retval;
} }
@@ -653,7 +652,7 @@ namespace UglyToad.Pdf.Cos
CosBase value = getDictionaryObject(key); CosBase value = getDictionaryObject(key);
if (value is CosString) if (value is CosString)
{ {
retval = ((CosString) value).GetString(); retval = ((CosString)value).GetString();
} }
return retval; return retval;
} }
@@ -741,7 +740,7 @@ namespace UglyToad.Pdf.Cos
public String getEmbeddedString(String embedded, CosName key, String defaultValue) public String getEmbeddedString(String embedded, CosName key, String defaultValue)
{ {
String retval = defaultValue; String retval = defaultValue;
CosDictionary dic = (CosDictionary) getDictionaryObject(embedded); CosDictionary dic = (CosDictionary)getDictionaryObject(embedded);
if (dic != null) if (dic != null)
{ {
retval = dic.getString(key, defaultValue); retval = dic.getString(key, defaultValue);
@@ -773,7 +772,7 @@ namespace UglyToad.Pdf.Cos
CosBase baseObj = getDictionaryObject(key); CosBase baseObj = getDictionaryObject(key);
if (baseObj is CosString) if (baseObj is CosString)
{ {
return DateConverter.toCalendar((CosString) baseObj); return DateConverter.toCalendar((CosString)baseObj);
} }
return null; return null;
@@ -870,7 +869,7 @@ namespace UglyToad.Pdf.Cos
{ {
var retval = defaultValue; var retval = defaultValue;
CosDictionary eDic = (CosDictionary) getDictionaryObject(embedded); CosDictionary eDic = (CosDictionary)getDictionaryObject(embedded);
if (eDic != null) if (eDic != null)
{ {
retval = eDic.getDate(key, defaultValue); retval = eDic.getDate(key, defaultValue);
@@ -922,7 +921,7 @@ namespace UglyToad.Pdf.Cos
CosBase boolValue = getDictionaryObject(firstKey, secondKey); CosBase boolValue = getDictionaryObject(firstKey, secondKey);
if (boolValue is CosBoolean) if (boolValue is CosBoolean)
{ {
retval = ((CosBoolean) boolValue).Value; retval = ((CosBoolean)boolValue).Value;
} }
return retval; return retval;
@@ -980,7 +979,7 @@ namespace UglyToad.Pdf.Cos
public int getEmbeddedInt(String embeddedDictionary, CosName key, int defaultValue) public int getEmbeddedInt(String embeddedDictionary, CosName key, int defaultValue)
{ {
int retval = defaultValue; int retval = defaultValue;
CosDictionary embedded = (CosDictionary) getDictionaryObject(embeddedDictionary); CosDictionary embedded = (CosDictionary)getDictionaryObject(embeddedDictionary);
if (embedded != null) if (embedded != null)
{ {
retval = embedded.getInt(key, defaultValue); retval = embedded.getInt(key, defaultValue);
@@ -1026,7 +1025,7 @@ namespace UglyToad.Pdf.Cos
CosBase obj = getDictionaryObject(keyList); CosBase obj = getDictionaryObject(keyList);
if (obj is ICosNumber) if (obj is ICosNumber)
{ {
retval = ((ICosNumber) obj).AsInt(); retval = ((ICosNumber)obj).AsInt();
} }
return retval; return retval;
} }
@@ -1161,7 +1160,7 @@ namespace UglyToad.Pdf.Cos
CosBase obj = getDictionaryObject(key); CosBase obj = getDictionaryObject(key);
if (obj is ICosNumber) if (obj is ICosNumber)
{ {
retval = ((ICosNumber) obj).AsLong(); retval = ((ICosNumber)obj).AsLong();
} }
return retval; return retval;
} }
@@ -1217,7 +1216,7 @@ namespace UglyToad.Pdf.Cos
CosBase obj = getDictionaryObject(key); CosBase obj = getDictionaryObject(key);
if (obj is ICosNumber) if (obj is ICosNumber)
{ {
retval = ((ICosNumber) obj).AsFloat(); retval = ((ICosNumber)obj).AsFloat();
} }
return retval; return retval;
} }
@@ -1382,18 +1381,18 @@ namespace UglyToad.Pdf.Cos
*/ */
public CosBase getObjectFromPath(String objPath) public CosBase getObjectFromPath(String objPath)
{ {
String[] path = objPath.Split(new string[] {PATH_SEPARATOR}, StringSplitOptions.RemoveEmptyEntries); String[] path = objPath.Split(new string[] { PATH_SEPARATOR }, StringSplitOptions.RemoveEmptyEntries);
CosBase retval = this; CosBase retval = this;
foreach (var pathString in path) foreach (var pathString in path)
{ {
if (retval is COSArray) if (retval is COSArray)
{ {
int idx = int.Parse(pathString.Replace("\\[", "").Replace("\\]", "")); int idx = int.Parse(pathString.Replace("\\[", "").Replace("\\]", ""));
retval = ((COSArray) retval).getObject(idx); retval = ((COSArray)retval).getObject(idx);
} }
else if (retval is CosDictionary) else if (retval is CosDictionary)
{ {
retval = ((CosDictionary) retval).getDictionaryObject(pathString); retval = ((CosDictionary)retval).getDictionaryObject(pathString);
} }
} }

View File

@@ -7,7 +7,7 @@ using UglyToad.Pdf.Core;
namespace UglyToad.Pdf.Cos namespace UglyToad.Pdf.Cos
{ {
public class CosFloat : CosBase, ICosNumber, ICosStreamWriter internal class CosFloat : CosBase, ICosNumber, ICosStreamWriter
{ {
private readonly decimal value; private readonly decimal value;
private readonly string valueAsString; private readonly string valueAsString;

View File

@@ -4,7 +4,7 @@ using UglyToad.Pdf.Core;
namespace UglyToad.Pdf.Cos namespace UglyToad.Pdf.Cos
{ {
public class CosInt : CosBase, ICosNumber, ICosStreamWriter internal class CosInt : CosBase, ICosNumber, ICosStreamWriter
{ {
/** /**
* The lowest integer to be kept in the {@link #STATIC} array. * The lowest integer to be kept in the {@link #STATIC} array.

View File

@@ -16,7 +16,7 @@ namespace UglyToad.Pdf.Cos
* *
* @author Ben Litchfield * @author Ben Litchfield
*/ */
public class CosName : CosBase, IComparable<CosName>, ICosStreamWriter internal class CosName : CosBase, IComparable<CosName>, ICosStreamWriter
{ {
// using ConcurrentHashMap because this can be accessed by multiple threads // using ConcurrentHashMap because this can be accessed by multiple threads
private static readonly ConcurrentDictionary<string, CosName> NameMap = new ConcurrentDictionary<string, CosName>(); private static readonly ConcurrentDictionary<string, CosName> NameMap = new ConcurrentDictionary<string, CosName>();

View File

@@ -5,7 +5,7 @@ namespace UglyToad.Pdf.Cos
using System.IO; using System.IO;
using Core; using Core;
public class CosNull : CosBase, ICosStreamWriter internal class CosNull : CosBase, ICosStreamWriter
{ {
/// <summary> /// <summary>
/// The Null Token /// The Null Token

View File

@@ -2,7 +2,7 @@
{ {
using ContentStream; using ContentStream;
public class CosObject : CosBase, ICosUpdateInfo internal class CosObject : CosBase, ICosUpdateInfo
{ {
private CosBase baseObject; private CosBase baseObject;
private long objectNumber; private long objectNumber;

View File

@@ -2,7 +2,7 @@
namespace UglyToad.Pdf.Cos namespace UglyToad.Pdf.Cos
{ {
public class CosObjectKey : IComparable<CosObjectKey> internal class CosObjectKey : IComparable<CosObjectKey>
{ {
public long Number { get; } public long Number { get; }
public long Generation { get; } public long Generation { get; }

View File

@@ -1,13 +1,12 @@
using System; namespace UglyToad.Pdf.Cos
using System.Text;
using System.IO;
namespace UglyToad.Pdf.Cos
{ {
using System;
using System.Text;
using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using Util; using Util;
public class CosString : CosBase internal class CosString : CosBase
{ {
public byte[] Bytes { get; } public byte[] Bytes { get; }

View File

@@ -5,7 +5,7 @@
using ContentStream; using ContentStream;
using Util.JetBrains.Annotations; using Util.JetBrains.Annotations;
public class CrossReferenceTable internal class CrossReferenceTable
{ {
public CrossReferenceType Type { get; } public CrossReferenceType Type { get; }

View File

@@ -21,7 +21,7 @@
/// giving the number of bytes from the beginning of the file to the beginning of the /// giving the number of bytes from the beginning of the file to the beginning of the
/// object. /// object.
/// </remarks> /// </remarks>
public class CrossReferenceTablePart internal class CrossReferenceTablePart
{ {
public IReadOnlyDictionary<CosObjectKey, long> ObjectOffsets { get; } public IReadOnlyDictionary<CosObjectKey, long> ObjectOffsets { get; }

View File

@@ -5,7 +5,7 @@
* *
* @author Michael Traut * @author Michael Traut
*/ */
public interface ICosVisitor internal interface ICosVisitor
{ {
/** /**
* Notification of visit to Array object. * Notification of visit to Array object.
@@ -34,15 +34,6 @@
*/ */
object VisitFromDictionary(CosDictionary obj); object VisitFromDictionary(CosDictionary obj);
/**
* Notification of visit to document object.
*
* @param obj The Object that is being visited.
* @return any Object depending on the visitor implementation, or null
* @throws IOException If there is an error while visiting this object.
*/
object VisitFromDocument(COSDocument obj);
/** /**
* Notification of visit to float object. * Notification of visit to float object.
* *

View File

@@ -7,7 +7,7 @@
/// <summary> /// <summary>
/// ASCII 85 (Base85) is a binary to text encoding using 5 ASCII characters per 4 bytes of data. /// ASCII 85 (Base85) is a binary to text encoding using 5 ASCII characters per 4 bytes of data.
/// </summary> /// </summary>
public class Ascii85Filter : IFilter internal class Ascii85Filter : IFilter
{ {
private const byte EmptyBlock = (byte)'z'; private const byte EmptyBlock = (byte)'z';
private const byte Offset = (byte)'!'; private const byte Offset = (byte)'!';

View File

@@ -16,7 +16,7 @@
/// See section 3.3.3 of the spec (version 1.7) for details on the FlateDecode filter. /// See section 3.3.3 of the spec (version 1.7) for details on the FlateDecode filter.
/// The flate decode filter may have a predictor function to further compress the stream. /// The flate decode filter may have a predictor function to further compress the stream.
/// </remarks> /// </remarks>
public class FlateFilter : IFilter internal class FlateFilter : IFilter
{ {
// Defaults are from table 3.7 in the spec (version 1.7) // Defaults are from table 3.7 in the spec (version 1.7)
private const int DefaultColors = 1; private const int DefaultColors = 1;

View File

@@ -2,7 +2,7 @@
{ {
using ContentStream; using ContentStream;
public interface IDecodeParameterResolver internal interface IDecodeParameterResolver
{ {
PdfDictionary GetFilterParameters(PdfDictionary streamDictionary, int index); PdfDictionary GetFilterParameters(PdfDictionary streamDictionary, int index);
} }

View File

@@ -2,7 +2,7 @@
{ {
using ContentStream; using ContentStream;
public interface IFilter internal interface IFilter
{ {
byte[] Decode(byte[] input, PdfDictionary streamDictionary, int filterIndex); byte[] Decode(byte[] input, PdfDictionary streamDictionary, int filterIndex);
} }

View File

@@ -0,0 +1,6 @@
namespace UglyToad.Pdf.Fonts.Parser.Handlers
{
internal class TrueTypeFontHandler
{
}
}

View File

@@ -10,7 +10,7 @@
/// <summary> /// <summary>
/// Store the results of a brute force search for all Cos Objects in the document so we only do it once. /// Store the results of a brute force search for all Cos Objects in the document so we only do it once.
/// </summary> /// </summary>
public class BruteForceSearcher internal class BruteForceSearcher
{ {
private const int MinimumSearchOffset = 6; private const int MinimumSearchOffset = 6;

View File

@@ -1,14 +1,10 @@
using System; namespace UglyToad.Pdf.Parser
using System.Collections.Generic;
using System.Text;
namespace UglyToad.Pdf.Parser
{ {
using System.Collections.ObjectModel; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Cos; using Cos;
public class XrefTrailerResolver internal class XrefTrailerResolver
{ {
/** /**

View File

@@ -6,7 +6,7 @@
using Cos; using Cos;
using Util.JetBrains.Annotations; using Util.JetBrains.Annotations;
public class DictionaryToken : IDataToken<IReadOnlyDictionary<IToken, IToken>> internal class DictionaryToken : IDataToken<IReadOnlyDictionary<IToken, IToken>>
{ {
[NotNull] [NotNull]
public IReadOnlyDictionary<IToken, IToken> Data { get; } public IReadOnlyDictionary<IToken, IToken> Data { get; }

View File

@@ -2,7 +2,7 @@
{ {
using Cos; using Cos;
public class NameToken : IDataToken<CosName> internal class NameToken : IDataToken<CosName>
{ {
public CosName Data { get; } public CosName Data { get; }

View File

@@ -1,13 +1,10 @@
using System; namespace UglyToad.Pdf.Util
using System.Collections.Generic;
using System.Text;
namespace UglyToad.Pdf.Util
{ {
using System;
using System.Globalization; using System.Globalization;
using Cos; using Cos;
public class DateConverter internal class DateConverter
{ {
private DateConverter() private DateConverter()
{ {